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

Make assertions in thread_context_test thread-safe

    • Fully Compatible
    • ALL
    • Service Arch 2021-05-17
    • 0

      It is unsafe to assert from the spawned threads in unit-tests, as such assertions are process fatal. We should change the assertions in thread_context_test (e.g., here) to be thread-safe. This could be done by using the ThreadAssertionMonitor.

      Moreover, the spawned threads could access non-thread safe metrics (shown below) that are defined here. Accessing these metrics must be serialized (e.g., by using atomics or a mutex) to ensure thread-safety.

      class ThreadContextTest : public unittest::Test {
      ...
      private:
          size_t _created;
          size_t _destroyed;
          size_t _destroyedOffThread;
      };
      

            Assignee:
            billy.donahue@mongodb.com Billy Donahue
            Reporter:
            amirsaman.memaripour@mongodb.com Amirsaman Memaripour
            Votes:
            0 Vote for this issue
            Watchers:
            4 Start watching this issue

              Created:
              Updated:
              Resolved: