Conversation
Signed-off-by: Mikhail Kornaukhov <mkornaukhov@serenedb.com>
|
Thanks for the fix, we tested both main and your change with TSAN enabled ( SUMMARY: ThreadSanitizer: data race (...) in However, we're seeing the same warnings with your fix applied. The TSAN output includes Mutex M... is already destroyed — the callback thread is calling Could you share the setup / repro steps you used to verify the fix? Curious if you saw TSAN clean on your end. |
|
@pulimsr Thanks for reviewing! The steps to reproduce are following:
{
"version": 8,
"configurePresets": [
{
"name": "tsan",
"binaryDir": "build_tsan",
"inherits": [
"lldb"
],
"cacheVariables": {
"CMAKE_BUILD_TYPE": "RelWithDebInfo",
"SDB_SANITIZE": "Thread"
}
}
]
}
Just complete
Without this fix I see stuff. But with this fix I do not see such rows. If you face any difficulties during reproducing this (building, launching tests or smth else) -- feel free to tag and contact me. |
|
Thanks for the details. I re-tested with Clang TSAN (instead of GCC) and confirmed the fix - PR to merge, Thank-you for your contribution |
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.
Check which platforms you have built SDK on to verify the correctness of this PR.
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.