Uploaded image for project: 'Drivers'
  1. Drivers
  2. DRIVERS-2165

Consider allowing (async) drivers to use locks to prevent concurrent ClientSession usage

    • Type: Icon: Spec Change Spec Change
    • Resolution: Duplicate
    • Priority: Icon: Major - P3 Major - P3
    • None
    • Component/s: Sessions
    • None
    • Needed

      In an asynchronous driver, it is easy for users to accidentally use a ClientSession concurrently for multiple operations. (see SERVER-43889 for an example of a user doing this in the C# driver.)

      Without some kind of locking mechanism built into ClientSession, the best we can do is thoroughly document that sessions can only be used by one operation at once and that users need to await the result of one operation before firing off another.

      Right now, the spec explicitly says:

      Drivers MUST NOT attempt to detect simultaneous use by multiple threads or processes 

      (rationale here). We should consider amending the spec to allow drivers to make their ClientSession types thread-safe.

            Assignee:
            Unassigned Unassigned
            Reporter:
            kaitlin.mahar@mongodb.com Kaitlin Mahar
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: