Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
33 changes: 33 additions & 0 deletions doc/changelog.rst
Original file line number Diff line number Diff line change
@@ -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
----------------------

Expand Down
24 changes: 15 additions & 9 deletions doc/faq.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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-fork-safe-details>`. 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>`.

.. _pymongo-fork-safe-details:

Expand Down