-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
Labels:None
-
Fully Compatible
-
ALL
-
Service Arch 2022-03-07
-
141
These tests create a waiter thread that generates timer-based activity on an opCtx, including making its wait member functions throw exceptions.
The TSAN alerts in BF-24287 were generated by the destructor of the waiter thread.
The destructor wrote over some DBException Status fields that were read by the main thread. Without a synchronization point after the main thread reads Status.code, the waiter thread shutdown destroys the Status.
This should be a false alarm, because the exception thrown by the packaged_task's callback function should be attached to the std::future associated with the std::packaged_task, and after delivery to the std::future, the std::future should no longer share any state with the std::packaged_task. Destruction of the task should not affect the delivered exception's Status object.
This race can be eliminated by destroying the packaged_task on the main thread, and joining the waiter thread at the bottom of the test's scope. Adding it as a data member of the WaitTestState achieves this.