Skip to content

Fix race in AsyncWaiter#3755

Open
mkornaukhov wants to merge 1 commit intoaws:mainfrom
serenedb:mkornaukhov/fix-race
Open

Fix race in AsyncWaiter#3755
mkornaukhov wants to merge 1 commit intoaws:mainfrom
serenedb:mkornaukhov/fix-race

Conversation

@mkornaukhov
Copy link

@mkornaukhov mkornaukhov commented Mar 19, 2026

Fix race. In MakeRequest() async waiter is passed to callback by reference in lambda. So we had concurrent Wakeup() and Wait() + destructor as variable is local. So after setting m_wakeupIntentional and unlocking, the wait method had finished and destructor of async writer and consequently destructor of condvar is called. The latest calls some pthread stuff that is concurrent with notify, so tsan detects it.

  • Did a review by yourself.
  • Tests: need to run with tsan
  • Checked if this PR is a breaking (APIs have been changed) change.
  • Checked if this PR will not introduce cross-platform inconsistent behavior.
  • Checked if this PR would require a ReadMe/Wiki update.

Check which platforms you have built SDK on to verify the correctness of this PR.

  • Linux
  • Windows
  • Android
  • MacOS
  • IOS
  • Other Platforms

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

Signed-off-by: Mikhail Kornaukhov <mkornaukhov@serenedb.com>
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.

1 participant