From 09aeef0f9d7118f3a1faaed78dcf88ba01180dc2 Mon Sep 17 00:00:00 2001 From: Ben Warner Date: Thu, 18 Aug 2022 15:30:45 -0700 Subject: [PATCH] Changelog 4.3 (#1038) --- doc/changelog.rst | 33 +++++++++++++++++++++++++++++++++ doc/faq.rst | 24 +++++++++++++++--------- 2 files changed, 48 insertions(+), 9 deletions(-) diff --git a/doc/changelog.rst b/doc/changelog.rst index 7afaca22a..a83df179c 100644 --- a/doc/changelog.rst +++ b/doc/changelog.rst @@ -1,6 +1,39 @@ Changelog ========= +Changes in Version 4.3 +---------------------- + +PyMongo 4.3 brings a number of improvements including: + +- Added support for decoding BSON datetimes outside of the range supported + by Python's :class:`~datetime.datetime` builtin. See + :ref:`handling-out-of-range-datetimes` for examples, as well as + :class:`bson.datetime_ms.DatetimeMS`, + :class:`bson.codec_options.DatetimeConversion`, and + :class:`bson.codec_options.CodecOptions`'s ``datetime_conversion`` + parameter for more details (`PYTHON-1824`_). +- Added support for using a :class:`~pymongo.mongo_client.MongoClient` after + an :py:func:`os.fork` (`PYTHON-2484`_). + +Bug fixes +......... + +- Fixed a bug where :class:`~pymongo.change_stream.ChangeStream` + would allow an app to retry calling ``next()`` or ``try_next()`` even + after non-resumable errors (`PYTHON-3389`_). + +Issues Resolved +............... + +See the `PyMongo 4.3 release notes in JIRA`_ for the list of resolved issues +in this release. + +.. _PYTHON-1824: https://jira.mongodb.org/browse/PYTHON-1824 +.. _PYTHON-2484: https://jira.mongodb.org/browse/PYTHON-2484 +.. _PYTHON-3389: https://jira.mongodb.org/browse/PYTHON-3389 +.. _PyMongo 4.3 release notes in JIRA: https://jira.mongodb.org/secure/ReleaseNote.jspa?projectId=10004&version=33425 + Changes in Version 4.2 ---------------------- diff --git a/doc/faq.rst b/doc/faq.rst index c48dd316e..a04f761f8 100644 --- a/doc/faq.rst +++ b/doc/faq.rst @@ -14,15 +14,21 @@ for threaded applications. Is PyMongo fork-safe? --------------------- -PyMongo is not fork-safe. Care must be taken when using instances of -:class:`~pymongo.mongo_client.MongoClient` with ``fork()``. Specifically, -instances of MongoClient must not be copied from a parent process to -a child process. Instead, the parent process and each child process must -create their own instances of MongoClient. Instances of MongoClient copied from -the parent process have a high probability of deadlock in the child process due -to the inherent incompatibilities between ``fork()``, threads, and locks -described :ref:`below `. PyMongo will attempt to -issue a warning if there is a chance of this deadlock occurring. +Starting in PyMongo 4.3, forking on a compatible Python interpreter while +using a client will result in all locks held by :class:`~bson.objectid +.ObjectId` and :class:`~pymongo.mongo_client.MongoClient` being released in +the child, as well as state shared between child and parent processes being +reset. + +If greenlet has been imported (usually with a library like gevent or +Eventlet), care must be taken when using instances of :class:`~pymongo +.mongo_client.MongoClient` with ``fork()``. Specifically, instances of +MongoClient must not be copied from a parent process to a child process. +Instead, the parent process and each child process must create their own +instances of MongoClient. Instances of MongoClient copied from the parent +process have a high probability of deadlock in the child process due to the +inherent incompatibilities between ``fork()``, threads, and locks described +:ref:`below`. .. _pymongo-fork-safe-details: