Skip to content

Commit 4310d43

Browse files
committed
Adds additional lock cleanup to worker cleanup
As another layer of security to guard against lock cleanup not occurring due to Redis not delivering the _release_resource task, ensure all locks are also cleaned up even for tasks that are in their final states. backports #7907 fixes #9547 (cherry picked from commit 516df31)
1 parent 9760583 commit 4310d43

File tree

2 files changed

+9
-2
lines changed

2 files changed

+9
-2
lines changed

CHANGES/9547.bugfix

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
Prevented a Redis failure scenario from causing the tasking system to back up due to "tasking system
2+
locks" not being released, even on worker restart.
3+
(backported from #7907)

pulpcore/tasking/services/worker_watcher.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -160,8 +160,12 @@ def mark_worker_offline(worker_name, normal_shutdown=False):
160160
pass
161161
else:
162162
# Cancel all of the tasks that were assigned to this worker's queue
163-
for task_status in worker.tasks.filter(state__in=TASK_INCOMPLETE_STATES):
164-
cancel(task_status.pk)
163+
for task in worker.tasks.filter(state__in=TASK_INCOMPLETE_STATES):
164+
cancel(task.pk)
165+
166+
# Ensure all locks are released for those tasks that are in final states also
167+
for task in worker.tasks.exclude(state__in=TASK_INCOMPLETE_STATES):
168+
task.release_resources()
165169

166170
if normal_shutdown:
167171
worker.gracefully_stopped = True

0 commit comments

Comments
 (0)