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

Fix Executor failures in ARS dtor during shutdown

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.14
    • Affects Version/s: 4.0.12
    • Component/s: Networking
    • Labels:
    • Fully Compatible
    • ALL
    • Service Arch 2019-09-23, Service Arch 2019-10-07, Service Arch 2019-10-21, Service Arch 2019-11-04

      There are a variety of bad races in global shutdown present in pre-4.2 versions of mongod and mongos. The principal problem is that we have a variety of background executors which are used for networking which are held on user threads by bare pointer. During global shutdown, we kill all user operations (which begins unwinding user stacks), while also shutting down and destroying those global objects. This can lead to use after frees, as well as scheduling errors, if those user threads unwind after global executor destruction.

      These problems tend to be rare because we do process termination via _Exit, which doesn't usually join user threads, meaning we tend only to see these problems in the presence of many user threads, where the shutdown thread get's descheduled at particular points in execution.

      Note that this problem also isn't present in 4.2 and later, as we've replaced the executor machinery so that executors are held by shared_ptr, and callbacks can see if they're being run on shutdown executors.

            ben.caimano@mongodb.com Benjamin Caimano (Inactive)
            mira.carey@mongodb.com Mira Carey
            1 Vote for this issue
            5 Start watching this issue