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

provide a way to ASSERT from a non-main thread in unit tests

    • Type: Icon: Improvement Improvement
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.9.0, 4.4.7
    • Affects Version/s: None
    • Component/s: Internal Code
    • None
    • Fully Compatible
    • v4.4
    • Service arch 2020-11-30
    • 28

      Investigating SERVER-51821, I found an ASSERT_EQ in a worker thread, which, if triggered, would crash the process with std::terminate. It is not valid to perform any kind of ASSERT from unit test thread other than the main thread.

      This cause of std::terminate is NOT ultimately the symptom of SERVER-51821, in which the controlling thread simply stopped (via throw) and never executed the explicit .join of the worker threads at the bottom of the test. But investigation of SERVER-51821 uncovered the ASSERT from non-main problem to be a very common weakness that exists in most of our concurrent unit tests.

      I propose that we identify ASSERTs that need to be fixed by changing ASSERT so that even if it passes, it will fail unless it is running on a safe thread.

            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: