Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Fix a potential dead lock in add_to_pending_deletion_list
  • Loading branch information
aisk committed Nov 9, 2025
commit fa0dd0be5d4b45660258c2fa8e5ebb5cb04dd694
8 changes: 7 additions & 1 deletion Python/optimizer.c
Original file line number Diff line number Diff line change
Expand Up @@ -296,11 +296,17 @@ add_to_pending_deletion_list(_PyExecutorObject *self)
interp->executor_deletion_list_head = self;
if (interp->executor_deletion_list_remaining_capacity > 0) {
interp->executor_deletion_list_remaining_capacity--;
EXECUTOR_LIST_UNLOCK(interp);
}
else {
/* Release the lock before calling _Py_ClearExecutorDeletionList
* to avoid deadlock, since it also tries to acquire the same lock */
EXECUTOR_LIST_UNLOCK(interp);
_Py_ClearExecutorDeletionList(interp);
EXECUTOR_LIST_LOCK(interp);
Comment on lines +303 to +307

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this?

interp->executor_deletion_list_head = self;
EXECUTOR_LIST_UNLOCK(interp);
}
EXECUTOR_LIST_UNLOCK(interp);
}

static void
Expand Down
Loading