-
Type: Bug
-
Resolution: Fixed
-
Priority: Unknown
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
Not Needed
-
In PYTHON-2484 we added a MongoClient._after_fork() hook that resets the topology state in hopes of making the client slightly more fork-safe. We later discovered in PYTHON-3406 that network I/O + threads in general is not fork-safe and we attempted to reinstate the warning:
warnings.warn( "MongoClient opened before fork. May not be entirely fork-safe, " "proceed with caution. See PyMongo's documentation for details: " "https://pymongo.readthedocs.io/en/stable/faq.html#" "is-pymongo-fork-safe", stacklevel=2, )
However, the MongoClient._after_fork() makes it such that the "MongoClient opened before fork" warning will never appear.
Note that in Python 3.12 the interpreter itself issues this warning:
/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/multiprocessing/popen_fork.py:66: DeprecationWarning: This process (pid=96002) is multi-threaded, use of fork() may lead to deadlocks in the child.
- is caused by
-
PYTHON-2484 Locks in PyMongo should be sanitized on fork
- Closed