amphp / redis

Efficient asynchronous communication with Redis servers, enabling scalable and responsive data storage and retrieval.

Home Page:https://amphp.org/redis

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Timed-out lock never released

trowski opened this issue · comments

If obtaining a lock in fails due to timeout, it appears the lock cannot be obtained again by another request. Guessing this is because the token remains in the queue, but is not removed?

It will eventually be moved due to

local queued = redis.call("lpop", queue)
redis.call("set", lock, queued, "px", ttl)
, but is then an unused lock and just expires after the lock time. The implementation should clean up the token from the queue instead.

The session did not appear to automatically unlock. It was still locked after several minutes, rather than only a few seconds. I did not change any of the default options. I had to manually remove the key to unlock the session.

The implementation should clean up the token from the queue instead.

Yes, then the first issue would also be fixed.