Uploaded image for project: 'Core Server'
  1. Core Server
  2. SERVER-64024

fix race in tearDown of ThreadedOperationDeadlineTests

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 6.0.0-rc0
    • 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.

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            billy.donahue@mongodb.com Billy Donahue
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: