-
Type: New Feature
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
In PYTHON-1332 I didn't implement the code to send "endSessions" when destroying a MongoClient. (The server side wasn't done yet.) This should be implemented, probably in Topology.close, which is called by MongoClient.close.
Sending "endSessions" cannot be automatic: adding a destructor method to MongoClient and trying to send "endSessions" from there is too risky. We can't safely do network I/O in a method that could be called by the cyclic garbage collector, we risk a deadlock or other catastrophes.
Let's document that in MongoDB 3.6, short-lived MongoClients should be closed at the end (but only the end!) of the program's life to avoid cluttering the server's sessions collection.
- related to
-
PYTHON-1332 Implement Drivers Sessions API
- Closed
-
DRIVERS-427 endSessions command no longer takes `ids` parameter
- Closed