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

mongo shell can end up creating multiple implicit sessions on the same replica set connection

    XMLWordPrintable

    Details

    • Backwards Compatibility:
      Fully Compatible
    • Operating System:
      ALL
    • Backport Requested:
      v4.4
    • Sprint:
      Sharding 2020-03-23
    • Linked BF Score:
      34

      Description

      The issue is that the mongo shell creates new _mongo variable every query (via setHiddenMongo) and this is the variable ends up being passed to _DelegatingDriverSession. Note that setHiddenMongo ends up creating new mongo variables because the connection the connection is actually a DBClientRS so runCommandWithTarget will return the connection to the primary. Thus, the comparison here will always fail. The variable also uses the same connection object, but since it is a new variable, it "forgets" everything about the connection, leaving the "authenticated" and "_defaulSession" variables undefined.

      This means that when getDB is called, it will end up trying to authenticate on the same c++ connection, which in turn will try to get the default session. But since it is a new variable, it will not have the _defaultSession variable set and end up creating a new one on the same cpp connection.

        Attachments

          Activity

            People

            Assignee:
            renctan Randolph Tan
            Reporter:
            janna.golden Janna Golden
            Participants:
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

              Dates

              Created:
              Updated:
              Resolved: