Skip to content

PYTHON-4019 Infinite loop in generic transactional provider due to dup keys #2438

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Jul 17, 2025
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions pymongo/asynchronous/client_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -660,6 +660,11 @@ async def callback(session, custom_arg, custom_kwarg=None):
``with_transaction`` starts a new transaction and re-executes
the ``callback``.

The ``callback`` MUST NOT silently handle command errors
without allowing such errors to propagate. Command errors may abort the
transaction on the server, and an attempt to commit the transaction will
be rejected with a ``NoSuchTransaction`` error.

When :meth:`~AsyncClientSession.commit_transaction` raises an exception with
the ``"UnknownTransactionCommitResult"`` error label,
``with_transaction`` retries the commit until the result of the
Expand Down
5 changes: 5 additions & 0 deletions pymongo/synchronous/client_session.py
Original file line number Diff line number Diff line change
Expand Up @@ -659,6 +659,11 @@ def callback(session, custom_arg, custom_kwarg=None):
``with_transaction`` starts a new transaction and re-executes
the ``callback``.

The ``callback`` MUST NOT silently handle command errors
without allowing such errors to propagate. Command errors may abort the
transaction on the server, and an attempt to commit the transaction will
be rejected with a ``NoSuchTransaction`` error.

When :meth:`~ClientSession.commit_transaction` raises an exception with
the ``"UnknownTransactionCommitResult"`` error label,
``with_transaction`` retries the commit until the result of the
Expand Down
Loading