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

Perform construction of ServiceContext after execution of mongo initializers, not during

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.0.3, 4.1.2
    • Affects Version/s: None
    • Component/s: Internal Code
    • Labels:
      None
    • Fully Compatible
    • Platforms 2018-07-30

      The "global" instance of ServiceContext is currently created by mongo initializers in all processes that link service_context.cpp. However, it's illegal to create threads inside mongo initializers. Also, test cases are supposed to construct their own ServiceContext per test case using the ServiceContextTest fixture or one of its relatives, so having the global one leads to programming errors in tests.

      This task is to remove the MONGO_INITIALIZER(ServiceContext) and instead manually instantiate the ServiceContext in mongos, mongod, and the embedded library, and then to fix the fallout.

            Assignee:
            henrik.edin@mongodb.com Henrik Edin
            Reporter:
            schwerin@mongodb.com Andy Schwerin
            Votes:
            0 Vote for this issue
            Watchers:
            5 Start watching this issue

              Created:
              Updated:
              Resolved: