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

benchRun should wait for the worker threads it spawns to exit

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.3, 4.1.4
    • Affects Version/s: None
    • Component/s: Performance
    • None
    • Fully Compatible
    • v4.0
    • TIG 2018-09-24
    • 26

      benchRun() calls .detach() on the worker threads it spawns. This means that despite calling _brState.waitForState(BenchRunState::BRS_FINISHED) to wait for the worker threads to not be considered "active", it doesn't wait for the worker threads to actually be destructed. There is then a race in mongoebench where the destructor for the thread_local ServiceContext::UniqueClient currentClient may not have run by the point embedded::shutdown() is called. Having benchRun() explicitly .join() the worker threads it spawns would fix this race.

      void BenchRunWorker::start() {
          stdx::thread([this] { run(); }).detach();
      }
      

            Assignee:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Reporter:
            max.hirschhorn@mongodb.com Max Hirschhorn
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: