-
Type:
Build Failure
-
Resolution: Done
-
Priority:
Minor - P4
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Name of Failure:
test.test_transactions.TestTransactionsConvenientAPI.test_callback_not_retried_after_csot_timeout
Link to task:
Context of when and why the failure occurred:
TBD
Stack trace:
[2026/08/21 12:34:51.211] FAILURE: pymongo.errors.WriteError: operation exceeded time limit, full error: {'index': 0, 'code': 50, 'errmsg': 'operation exceeded time limit'} ()
[2026/08/21 12:34:51.211] self = <test.test_transactions.TestTransactionsConvenientAPI testMethod=test_callback_not_retried_after_csot_timeout>
[2026/08/21 12:34:51.211] @client_context.require_transactions
[2026/08/21 12:34:51.211] @unittest.skipIf(
[2026/08/21 12:34:51.211] sys.platform == "darwin" and "CI" in os.environ,
[2026/08/21 12:34:51.211] "PYTHON-5861: $where is too slow on macOS CI",
[2026/08/21 12:34:51.211] )
[2026/08/21 12:34:51.211] def test_callback_not_retried_after_csot_timeout(self):
[2026/08/21 12:34:51.211] listener = OvertCommandListener()
[2026/08/21 12:34:51.211] client = self.rs_client(event_listeners=[listener])
[2026/08/21 12:34:51.211] coll = client[self.db.name].test
[2026/08/21 12:34:51.211]
[2026/08/21 12:34:51.211] def callback(session):
[2026/08/21 12:34:51.211] coll.insert_one({}, session=session)
[2026/08/21 12:34:51.211] err: dict = {
[2026/08/21 12:34:51.211] "ok": 0,
[2026/08/21 12:34:51.211] "errmsg": "Transaction 7819 has been aborted.",
[2026/08/21 12:34:51.211] "code": 251,
[2026/08/21 12:34:51.211] "codeName": "NoSuchTransaction",
[2026/08/21 12:34:51.211] "errorLabels": ["TransientTransactionError"],
[2026/08/21 12:34:51.211] }
[2026/08/21 12:34:51.211] raise OperationFailure(err["errmsg"], err["code"], err)
[2026/08/21 12:34:51.211]
[2026/08/21 12:34:51.211] # Create the collection.
[2026/08/21 12:34:51.211] coll.insert_one({})
[2026/08/21 12:34:51.211] listener.reset()
[2026/08/21 12:34:51.211] with client.start_session() as s:
[2026/08/21 12:34:51.211] with pymongo.timeout(1.0):
[2026/08/21 12:34:51.211] with self.assertRaises(ExecutionTimeout):
[2026/08/21 12:34:51.211] > s.with_transaction(callback)
[2026/08/21 12:34:51.211] test/test_transactions.py:600:
[2026/08/21 12:34:51.211] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[2026/08/21 12:34:51.211] pymongo/synchronous/client_session.py:785: in with_transaction
[2026/08/21 12:34:51.211] ret = callback(self)
[2026/08/21 12:34:51.211] ^^^^^^^^^^^^^^
[2026/08/21 12:34:51.211] test/test_transactions.py:584: in callback
[2026/08/21 12:34:51.211] coll.insert_one({}, session=session)
[2026/08/21 12:34:51.211] pymongo/synchronous/collection.py:884: in insert_one
[2026/08/21 12:34:51.211] self._insert_one(
[2026/08/21 12:34:51.211] pymongo/synchronous/collection.py:824: in _insert_one
[2026/08/21 12:34:51.211] self._database.client._retryable_write(
[2026/08/21 12:34:51.211] pymongo/synchronous/mongo_client.py:2060: in _retryable_write
[2026/08/21 12:34:51.211] return self._retry_with_session(retryable, func, s, bulk, operation, operation_id)
[2026/08/21 12:34:51.211] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026/08/21 12:34:51.211] pymongo/synchronous/mongo_client.py:1930: in _retry_with_session
[2026/08/21 12:34:51.211] return self._retry_internal(
[2026/08/21 12:34:51.211] pymongo/_csot.py:126: in csot_wrapper
[2026/08/21 12:34:51.211] return func(self, *args, **kwargs)
[2026/08/21 12:34:51.211] ^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026/08/21 12:34:51.211] pymongo/synchronous/mongo_client.py:1970: in _retry_internal
[2026/08/21 12:34:51.211] return _ClientConnectionRetryable(
[2026/08/21 12:34:51.211] pymongo/synchronous/mongo_client.py:2906: in run
[2026/08/21 12:34:51.211] res = self._read() if self._is_read else self._write()
[2026/08/21 12:34:51.211] ^^^^^^^^^^^^^
[2026/08/21 12:34:51.211] pymongo/synchronous/mongo_client.py:3125: in _write
[2026/08/21 12:34:51.211] return self._func(self._session, conn, self._retryable) # type: ignore
[2026/08/21 12:34:51.211] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
[2026/08/21 12:34:51.211] pymongo/synchronous/collection.py:822: in _insert_command
[2026/08/21 12:34:51.211] _check_write_command_response(result)
[2026/08/21 12:34:51.211] pymongo/helpers_shared.py:311: in _check_write_command_response
[2026/08/21 12:34:51.211] _raise_last_write_error(write_errors)
[2026/08/21 12:34:51.211] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _
[2026/08/21 12:34:51.211] def _raise_last_write_error(write_errors: list[Any]) -> NoReturn:
[2026/08/21 12:34:51.211] # If the last batch had multiple errors only report
[2026/08/21 12:34:51.211] # the last error to emulate continue_on_error.
[2026/08/21 12:34:51.211] error = write_errors[-1]
[2026/08/21 12:34:51.211] if error.get("code") == 11000:
[2026/08/21 12:34:51.211] raise DuplicateKeyError(error.get("errmsg"), 11000, error)
[2026/08/21 12:34:51.211] > raise WriteError(error.get("errmsg"), error.get("code"), error)
[2026/08/21 12:34:51.211] E pymongo.errors.WriteError: operation exceeded time limit, full error: {'index': 0, 'code': 50, 'errmsg': 'operation exceeded time limit'}
[2026/08/21 12:34:51.211] pymongo/helpers_shared.py:282: WriteError