Clear old locks when server starts?
See original GitHub issueIf the server goes down while a task is running and has acquired a lock, the lock is still in place when the server comes back up. It isn’t released until the default timeout has expired and there doesn’t seem to be any clean mechanism for dealing with this.
A similar project to this called celery-singleton has a clear_locks
API that removes any locks. This can be called when workers are first ready.
from celery.signals import worker_ready
from celery_singleton import clear_locks
from somewhere import celery_app
@worker_ready()
def unlock_all(**kwargs):
clear_locks(celery_app)
Does such a mechanism exist for this project? Maybe I’m missing it. If it doesn’t exist, would this be a welcome feature?
Issue Analytics
- State:
- Created 4 years ago
- Comments:6 (1 by maintainers)
Top Results From Across the Web
How to delete lock file if service failed to start - Super User
All you need to do is replace MyServiceName with the short name of your service and then put this batch file in your...
Read more >File locks persisting after shutdown/restart (Causes ... - TechNet
When fast startup is enabled, a shutdown isn't really a shutdown, and powering the machine back on seemingly allows that interrupted process to ......
Read more >Solution to remove lock after Application server redeployment
If the lock file won't delete, what is done is to kill the process, other options we do is to totally stop the...
Read more >How to prevent samba from holding a file lock after a client ...
the below steps have helped me resolve this exact issue on a number of occasions: Login to the samba server. Run a "smbstatus"....
Read more >Why do file geodatabase .lock files remain after a process is ...
Use the Compact geoprocessing tool in ArcCatalog to safely remove inactive .lock files from a file geodatabase. Navigate to ArcToolbox > Data ...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Btw, if anyone is curious, this is really easy to do without any special API call:
How would the proposed solution work with multiple workers connecting to the same backend? For example
worker1
might set a lock,worker2
might crash, reinitialize and remove all locks on connect, which is obviously not ok.EDIT: actually, now that I think about, the worst case seems to be an overlap of at most 2 tasks (assuming only one lock key is used), not a big deal.