🐛 redis.exceptions.LockNotOwnedError: Cannot extend a lock that's no longer owned #119
-
Bug DescriptionRedis container: redis:8.0.1 Python version: 3.12.10 Python dependencies: settings.py
Error occurs every every 0-10 minutes until container is stopped Version1.0.10 Stack traceDocker compose logs:
Steps to ReproduceNo response Expected BehaviorError should not occur. |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 5 replies
-
Hi @hihosilvers. Thanks for reporting your issue. Package versions are the same for us.
We had a spike of this error somewhere in the past. I did not dig further yet. Perhaps our config would provide you with something to get started. If not, perhaps @amureki would what to try. |
Beta Was this translation helpful? Give feedback.
-
Hi @hihosilvers 👋, Thanks for reaching out. We switch to a dead man snitch approach, to ensure deadlocks. Meaning, a scheduler process needs to check in frequently with a heart beat. If not, the lock will expire and a new process can assume the role of the scheduler. If you are encountering this issue, your scheduler process didn't review the lock. Meaning, it didn't schedule jobs reliably. We are happy to help you debug this, but we would need additional information about your environment. How are you running your application? Generally, if are automatically restarting the working, you don't experience any major discrepancies. However, it might be still worth looking into this. I hope our response already help you a little. Please don't hesitate to reach out again. Best |
Beta Was this translation helpful? Give feedback.
-
I am running into this problem as well and I believe there is a bug in how When Steps to reproduce
Current behaviorThe scheduler remains active and continues attempting to extend a lock it no longer owns, potentially resulting in multiple instances running concurrently. Expected behaviorIf the lock extension fails due to Suggested fixCatch |
Beta Was this translation helpful? Give feedback.
Hi,
Thanks, you are welcome, we love to help!
The lock extension task is not run on dramatiq, but directly via the scheduler. Unless your CPU has no time to pick up the thread, that shouldn't be a likely cause. In most cases, it will be the Redis setup that is loosing data. Which isn't great. If your services restarts frequently, I would consider altering the
appendfsync
setting, to increase durability.Anyhow, the pending patch should resolve the issue as long as your orchestration restarts the crontab process.
Best,
Joe