Based on my conversation here:
https://stackoverflow.com/questions/46441918/mongoclient-opened-before-fork-create-mongoclient/
It seems like this warning still confuses people:
UserWarning: MongoClient opened before fork. Create MongoClient with connect=False, or create client after forking. See PyMongo's documentation for details: http://api.mongodb.org/python/current/faq.html#pymongo-fork-safe>
Users might think that passing connect=False makes a client fork-safe. In fact, if they pass connect=False and use the client in a way that triggers connection, and then fork, they still risk deadlock.
The doc that the warning links to doesn't mention creating a MongoClient with connect=False.
Let's try once again to help people understand how to use PyMongo in forking programs. We have a couple options:
- Explain in the doc how to create a MongoClient with connect=False and warn users not to trigger auto-connection until after they fork
- Leave the doc as-is and remove the warning's mention of connect=False
Either way let's remove the ">" from the end of the warning message.
(Thanks for the suggestion thiago.galesi@10gen.com.)
- is related to
-
PYTHON-4702 MongoClient should default to connect=False
- Backlog