-
Type: Bug
-
Resolution: Fixed
-
Priority: Major - P3
-
Affects Version/s: None
-
Component/s: None
-
None
Topology's events executor is not closed as soon as it could be when the topology is garbage collected: https://github.com/mongodb/mongo-python-driver/blob/3.8.0/pymongo/topology.py#L116-L131
The weakref.ref is defined like this:
# We strongly reference the executor and it weakly references # the queue via this closure. When the topology is freed, stop # the executor soon. weak = weakref.ref(self._events)
It should pass the executor's close method:
weak = weakref.ref(self._events, executor.close)
Without executor.close the Topology events executor will still be closed but it will wait until the executor actually attempts to run (1 second instead of 0.5 seconds).
- is related to
-
PYTHON-1896 MongoClient hangs for 0.5 seconds on script exit
- Closed