[13.x] Don't force release a unique lock the job never acquired - #61234
Open
sulimanbenhalim wants to merge 1 commit into
Open
[13.x] Don't force release a unique lock the job never acquired#61234sulimanbenhalim wants to merge 1 commit into
sulimanbenhalim wants to merge 1 commit into
Conversation
…g another dispatch's lock
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Follow up to #60906.
UniqueLock::release()falls back toforceRelease()when a job has no owner token. That's right for a job that's actually holding the lock, but a job pushed straight onto the queue never acquires one, so on rollback it wipes out a lock a different dispatch is holding.Queue::push()andQueue::later()register the rollback callback throughenqueueUsing(), but they don't go throughPendingDispatch, which is where the lock actually gets acquired.Same failure mode you fixed for retries in #60906, just at a different call site. A job using
Queueablealways records an owner when it acquires, so an empty owner means it never had the lock and has nothing to release.I kept the check in the rollback callback instead of putting it in
UniqueLock::release(). Doing it inrelease()would also change the processing path, and sinceuniqueFordefaults to 0 the lock has no expiry, so a job serialized before #60906 (no owner in its payload) would leak its lock permanently after upgrading.addCallbackForRollbackis still registered either way, so theQueueConnectionTestexpectations are untouched.Test sits with the other unique lock tests and fails without the change.