Skip to content

fix: release versionedQueuesLock on early return in describe()#10077

Open
sanbricio wants to merge 1 commit intotemporalio:mainfrom
sanbricio:fix/release-rwmutex-lock-on-describe-early-return
Open

fix: release versionedQueuesLock on early return in describe()#10077
sanbricio wants to merge 1 commit intotemporalio:mainfrom
sanbricio:fix/release-rwmutex-lock-on-describe-early-return

Conversation

@sanbricio
Copy link
Copy Markdown

@sanbricio sanbricio commented Apr 26, 2026

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?

  • built
  • run locally and tested manually
  • covered by existing tests
  • added new unit test(s) - TestDescribeReleasesVersionedQueuesLockWhenDefaultQueueNotInitialized
  • added new functional test(s)

Potential risks

No impact only solving a dedlock bug

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.
@sanbricio sanbricio requested a review from a team as a code owner April 26, 2026 15:34
@CLAassistant
Copy link
Copy Markdown

CLAassistant commented Apr 26, 2026

CLA assistant check
All committers have signed the CLA.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants