Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

"LockNotOwnedError: Cannot extend a lock that's no longer owned" When laptop goes to sleep. #218

Open
Cediddi opened this issue Jun 15, 2022 · 3 comments

Comments

@Cediddi
Copy link

Cediddi commented Jun 15, 2022

Hi,

I'm running redis and redbeat in docker containers. I've set celery_beat_max_loop_interval=5 and redbeat_lock_timeout= celery_beat_max_loop_interval * 5 which means it takes 25 seconds for redis to release the lock and every 5 seconds, the ttl gets extended.

My problem happens when I let my laptop go to sleep for more than 25 seconds (go grab a coffee) and when I reopen my laptop's lid, redbeat freaks out. It says I cannot release a lock that's no longer owned because the process is shutting down because it cannot extend a lock that is no longer owned (or existing)

I think this is not a bug but a design decision. Then what should I do? Should I set --restart=on-failure on docker?

@hotwater9
Copy link

hotwater9 commented Jul 13, 2023

I run into the same problems as you, I do the same on my server. But when they work correctly for a while, the problem randomly arises. Nothing happens to the analysis log, as if the lock really expired and disappeared, but shouldn't it be renewed all the time?
So I was wondering if you found the problem?

@Cediddi
Copy link
Author

Cediddi commented Jul 13, 2023

I couldn't find a solution, but I increased celery_beat_max_loop_interval=30 in addition to redbeat_lock_timeout: int = celery_beat_max_loop_interval * 5. I've also made the containers restart on failure with docker compose. On kubernetes, the same.

@hotwater9
Copy link

It means that you solved the problem by shortening the polling interval of the beat service, ok,which is the only solution I have found so far

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants