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

Call curl_global_init before threading enabled

    • Type: Icon: Bug Bug
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 4.4.15, 6.0.0-rc7, 5.0.10, 6.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Fully Compatible
    • ALL
    • v6.0, v5.0, v4.4
    • Security 2022-05-16

      curl_global_init is not thread safe:

      This function is not thread safe. You must not call it when any other thread in the program (i.e. a thread sharing the same memory) is running. This does not just mean no other thread that is using libcurl. Because curl_global_init calls functions of other libraries that are similarly thread unsafe, it could conflict with any other thread that uses these other libraries.

      We call this method in CurlLibraryManager::_initializeGlobal, which we call in initialize which we call whenever we create a new handle.

      We should create a MONGO_INITIALIZER to initialize curl before we spawn threads in the database.

            Assignee:
            gabriel.marks@mongodb.com Gabriel Marks
            Reporter:
            spencer.jackson@mongodb.com Spencer Jackson
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Created:
              Updated:
              Resolved: