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

Dont call getNewSession() as a parameter of a function

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Major - P3 Major - P3
    • 8.1.0-rc0
    • Affects Version/s: None
    • Component/s: None
    • None
    • Catalog and Routing
    • Fully Compatible
    • CAR Team 2024-09-30
    • 2

      In create_collection_coordinator.cpp we are calling many times the getNewSession() method directly as the parameter of other calls (like here).

      This is quite dangerous because getNewSession() updates the attribute _doc, so anyone using a reference or pointer to `_doc` within the same call will get an undefined behavior.

      Here is an example that can end up badly:

      myFunc(_doc.getNss(), getNewSession(opCtx))
      

            Assignee:
            adam.farkas@mongodb.com Wolfee Farkas
            Reporter:
            silvia.surroca@mongodb.com Silvia Surroca
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: