fix: release versionedQueuesLock on early return in describe()#10077
Open
sanbricio wants to merge 1 commit intotemporalio:mainfrom
Open
fix: release versionedQueuesLock on early return in describe()#10077sanbricio wants to merge 1 commit intotemporalio:mainfrom
sanbricio wants to merge 1 commit intotemporalio:mainfrom
Conversation
When buildIds contains an empty string and defaultQueue() returns nil, describe() returned errDefaultQueueNotInit without first releasing the RLock acquired at the start of the function, leaving the mutex permanently locked and blocking any concurrent writers.
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.
When buildIds contains an empty string and defaultQueue() returns nil, describe() returned errDefaultQueueNotInit without first releasing the RLock acquired at the start of the function, leaving the mutex permanently locked and blocking any concurrent writers. I've detected these bug using my own linter for concurrency https://github.com/sanbricio/goconcurrencylint
What changed?
Added missing versionedQueuesLock.RUnlock() in describe() before the early return when defaultQueue() returns nil.
Why?
The function acquires RLock at the top but does not use defer instead releases the lock manually at each exit point. One early return path was missing the RUnlock: when buildIds contains "" and the default queue is not yet initialized, the function returned errDefaultQueueNotInit without releasing the lock, leaving the mutex permanently locked and blocking any concurrent writer.
How did you test it?
Potential risks
No impact only solving a dedlock bug