Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-1383

Don't mention "connect=False" in fork warning

    XMLWordPrintable

    Details

    • Type: Improvement
    • Status: Closed
    • Priority: Minor - P4
    • Resolution: Fixed
    • Affects Version/s: None
    • Fix Version/s: 3.6
    • Component/s: Documentation
    • Labels:
      None

      Description

      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.)

        Attachments

          Activity

            People

            • Votes:
              0 Vote for this issue
              Watchers:
              2 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: