From 92a2c944153955e70f51a8e16329fb427a380e40 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Tue, 25 Feb 2025 11:12:42 -0800 Subject: [PATCH 1/2] PYTHON-5155 Fix FAQ link for fork safety (#2156) (cherry picked from commit 0ac56a3019dd9f913aa4083f9311d93ad310a793) --- doc/changelog.rst | 2 +- pymongo/asynchronous/topology.py | 4 +--- pymongo/synchronous/topology.py | 4 +--- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 66f3efca88..fcad842def 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -208,7 +208,7 @@ Issues Resolved See the `PyMongo 4.9 release notes in JIRA`_ for the list of resolved issues in this release. -.. _Is PyMongo Fork-Safe : https://www.mongodb.com/docs/languages/python/pymongo-driver/current/faq/#is-pymongo-fork-safe- +.. _Is PyMongo Fork-Safe: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/troubleshooting/#forking-a-process-causes-a-deadlock .. _PyMongo 4.9 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=39940 diff --git a/pymongo/asynchronous/topology.py b/pymongo/asynchronous/topology.py index 6d67710a7e..f94977aeae 100644 --- a/pymongo/asynchronous/topology.py +++ b/pymongo/asynchronous/topology.py @@ -232,9 +232,7 @@ async def open(self) -> None: warnings.warn( # type: ignore[call-overload] # noqa: B028 "AsyncMongoClient opened before fork. May not be entirely fork-safe, " "proceed with caution. See PyMongo's documentation for details: " - "https://www.mongodb.com/docs/languages/" - "python/pymongo-driver/current/faq/" - "#is-pymongo-fork-safe-", + "https://www.mongodb.com/docs/languages/python/pymongo-driver/current/troubleshooting/#forking-a-process-causes-a-deadlock", **kwargs, ) async with self._lock: diff --git a/pymongo/synchronous/topology.py b/pymongo/synchronous/topology.py index b03269ae43..a6bc0d3a26 100644 --- a/pymongo/synchronous/topology.py +++ b/pymongo/synchronous/topology.py @@ -232,9 +232,7 @@ def open(self) -> None: warnings.warn( # type: ignore[call-overload] # noqa: B028 "MongoClient opened before fork. May not be entirely fork-safe, " "proceed with caution. See PyMongo's documentation for details: " - "https://www.mongodb.com/docs/languages/" - "python/pymongo-driver/current/faq/" - "#is-pymongo-fork-safe-", + "https://www.mongodb.com/docs/languages/python/pymongo-driver/current/troubleshooting/#forking-a-process-causes-a-deadlock", **kwargs, ) with self._lock: From 42c377db77207952f26252de96771823fdf90cb0 Mon Sep 17 00:00:00 2001 From: Shane Harvey Date: Mon, 3 Mar 2025 12:07:43 -0800 Subject: [PATCH 2/2] PYTHON-5155 Use dochub link for fork warning (#2173) (cherry picked from commit 5ac262783f7fae2bc95ba354aad0ab27d5c23423) --- doc/changelog.rst | 3 +-- pymongo/asynchronous/topology.py | 2 +- pymongo/synchronous/topology.py | 2 +- 3 files changed, 3 insertions(+), 4 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index fcad842def..cf5d5e8ff7 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -199,7 +199,7 @@ PyMongo 4.9 brings a number of improvements including: unction-as-a-service (FaaS) like AWS Lambda, Google Cloud Functions, and Microsoft Azure Functions. On some FaaS systems, there is a ``fork()`` operation at function startup. By delaying the connection to the first operation, we avoid a deadlock. See - `Is PyMongo Fork-Safe`_ for more information. + :ref:`pymongo-fork-safe` for more information. Issues Resolved @@ -208,7 +208,6 @@ Issues Resolved See the `PyMongo 4.9 release notes in JIRA`_ for the list of resolved issues in this release. -.. _Is PyMongo Fork-Safe: https://www.mongodb.com/docs/languages/python/pymongo-driver/current/troubleshooting/#forking-a-process-causes-a-deadlock .. _PyMongo 4.9 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=39940 diff --git a/pymongo/asynchronous/topology.py b/pymongo/asynchronous/topology.py index f94977aeae..07671c9a70 100644 --- a/pymongo/asynchronous/topology.py +++ b/pymongo/asynchronous/topology.py @@ -232,7 +232,7 @@ async def open(self) -> None: warnings.warn( # type: ignore[call-overload] # noqa: B028 "AsyncMongoClient opened before fork. May not be entirely fork-safe, " "proceed with caution. See PyMongo's documentation for details: " - "https://www.mongodb.com/docs/languages/python/pymongo-driver/current/troubleshooting/#forking-a-process-causes-a-deadlock", + "https://dochub.mongodb.org/core/pymongo-fork-deadlock", **kwargs, ) async with self._lock: diff --git a/pymongo/synchronous/topology.py b/pymongo/synchronous/topology.py index a6bc0d3a26..861712f02a 100644 --- a/pymongo/synchronous/topology.py +++ b/pymongo/synchronous/topology.py @@ -232,7 +232,7 @@ def open(self) -> None: warnings.warn( # type: ignore[call-overload] # noqa: B028 "MongoClient opened before fork. May not be entirely fork-safe, " "proceed with caution. See PyMongo's documentation for details: " - "https://www.mongodb.com/docs/languages/python/pymongo-driver/current/troubleshooting/#forking-a-process-causes-a-deadlock", + "https://dochub.mongodb.org/core/pymongo-fork-deadlock", **kwargs, ) with self._lock: