-
Type: Spec Change
-
Resolution: Duplicate
-
Priority: 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.
- related to
-
DRIVERS-2096 Document usability of async methods with sessions (ex: ReplaceOneAsync)
- Backlog