Uploaded image for project: 'Python Driver'
  1. Python Driver
  2. PYTHON-4258

[Build Failure] test_unpin_after_TransientTransactionError_error_on_abort

    • Type: Icon: Build Failure Build Failure
    • Resolution: Duplicate
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • Labels:
      None
    • Python Drivers
    • Hide

      1. What would you like to communicate to the user about this feature?
      2. Would you like the user to see examples of the syntax and/or executable code and its output?
      3. Which versions of the driver/connector does this apply to?

      Show
      1. What would you like to communicate to the user about this feature? 2. Would you like the user to see examples of the syntax and/or executable code and its output? 3. Which versions of the driver/connector does this apply to?

      Name of Failure:

      test.test_transactions_unified.TestUnifiedMongosUnpin.test_unpin_after_TransientTransactionError_error_on_abort

      Link to task:

      https://spruce.mongodb.com/task/mongo_python_driver_tests_python_version_rhel8_test_ssl__platform~rhel8_auth_ssl~auth_ssl_python_version~3.12_coverage~coverage_test_4.4_sharded_cluster_af2d56c5b508003d564c25433613200583cb15d7_24_03_04_19_55_00?execution=0&sortBy=STATUS&sortDir=ASC

      Context of when and why the failure occurred:

      Occurring randomly starting with PYTHON-4243, which was an EVG config-only change.
      It seems to only occur on 4.4 and latest.

      Stack trace:

       [2024/03/04 14:37:16.608] FAILURE: pymongo.errors.OperationFailure: Transaction a1d206f1-986c-4975-b3c5-53e1c4a22665:1 was aborted on statement 0 due to: a non-retryable snapshot error :: caused by :: Database mongos-unpin-db has undergone a catalog change operation at time { : Timestamp(1709584519, 5) } and no longer satisfies the requirements for the current transaction which requires { : Timestamp(1709584518, 40) }. Transaction will be aborted., full error: {'ok': 0.0, 'errmsg': 'Transaction a1d206f1-986c-4975-b3c5-53e1c4a22665:1 was aborted on statement 0 due to: a non-retryable snapshot error :: caused by :: Database mongos-unpin-db has undergone a catalog change operation at time { : Timestamp(1709584519, 5) } and no longer satisfies the requirements for the current transaction which requires { : Timestamp(1709584518, 40) }. Transaction will be aborted.', 'code': 272, 'codeName': 'MigrationConflict', 'operationTime': Timestamp(1709584519, 8), '$clusterTime': {'clusterTime': Timestamp(1709584519, 8), 'signature': {'hash': b'\\\x07\x9f\xf8SLz\x83\xa36\x9a\x9c\xa7\x06\xd2,\xeejCU', 'keyId': 7342606618145587224}}, 'errorLabels': ['TransientTransactionError']} ()
       [2024/03/04 14:37:16.608] self = <test.test_transactions_unified.TestUnifiedMongosUnpin testMethod=test_unpin_after_TransientTransactionError_error_on_abort>
       [2024/03/04 14:37:16.608]     def test_case(self):
       [2024/03/04 14:37:16.608] >       self.run_scenario(spec)
       [2024/03/04 14:37:16.608] test/unified_format.py:1854: 
       [2024/03/04 14:37:16.608] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2024/03/04 14:37:16.608] test/unified_format.py:1801: in run_scenario
       [2024/03/04 14:37:16.608]     self._run_scenario(spec, uri)
       [2024/03/04 14:37:16.608] test/unified_format.py:1831: in _run_scenario
       [2024/03/04 14:37:16.608]     self.run_operations(spec["operations"])
       [2024/03/04 14:37:16.608] test/unified_format.py:1693: in run_operations
       [2024/03/04 14:37:16.608]     self.run_entity_operation(op)
       [2024/03/04 14:37:16.608] test/unified_format.py:1435: in run_entity_operation
       [2024/03/04 14:37:16.608]     result = cmd(**dict(arguments))
       [2024/03/04 14:37:16.608] pymongo/collection.py:659: in insert_one
       [2024/03/04 14:37:16.608]     self._insert_one(
       [2024/03/04 14:37:16.608] pymongo/collection.py:599: in _insert_one
       [2024/03/04 14:37:16.608]     self.__database.client._retryable_write(
       [2024/03/04 14:37:16.608] pymongo/mongo_client.py:1559: in _retryable_write
       [2024/03/04 14:37:16.608]     return self._retry_with_session(retryable, func, s, bulk, operation, operation_id)
       [2024/03/04 14:37:16.608] pymongo/mongo_client.py:1445: in _retry_with_session
       [2024/03/04 14:37:16.608]     return self._retry_internal(
       [2024/03/04 14:37:16.608] pymongo/_csot.py:107: in csot_wrapper
       [2024/03/04 14:37:16.608]     return func(self, *args, **kwargs)
       [2024/03/04 14:37:16.608] pymongo/mongo_client.py:1491: in _retry_internal
       [2024/03/04 14:37:16.608]     ).run()
       [2024/03/04 14:37:16.608] pymongo/mongo_client.py:2337: in run
       [2024/03/04 14:37:16.608]     return self._read() if self._is_read else self._write()
       [2024/03/04 14:37:16.608] pymongo/mongo_client.py:2454: in _write
       [2024/03/04 14:37:16.608]     return self._func(self._session, conn, self._retryable)  # type: ignore
       [2024/03/04 14:37:16.608] pymongo/collection.py:587: in _insert_command
       [2024/03/04 14:37:16.608]     result = conn.command(
       [2024/03/04 14:37:16.608] pymongo/helpers.py:324: in inner
       [2024/03/04 14:37:16.608]     return func(*args, **kwargs)
       [2024/03/04 14:37:16.608] pymongo/pool.py:985: in command
       [2024/03/04 14:37:16.608]     return command(
       [2024/03/04 14:37:16.608] pymongo/network.py:212: in command
       [2024/03/04 14:37:16.608]     helpers._check_command_response(
       [2024/03/04 14:37:16.608] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2024/03/04 14:37:16.608] response = {'$clusterTime': {'clusterTime': Timestamp(1709584519, 8), 'signature': {'hash': b'\\\x07\x9f\xf8SLz\x83\xa36\x9a\x9c\...rements for the current transaction which requires { : Timestamp(1709584518, 40) }. Transaction will be aborted.', ...}
       [2024/03/04 14:37:16.608] max_wire_version = 9, allowable_errors = None, parse_write_concern_error = False
       [2024/03/04 14:37:16.608]     def _check_command_response(
       [2024/03/04 14:37:16.608]         response: _DocumentOut,
       [2024/03/04 14:37:16.608]         max_wire_version: Optional[int],
       [2024/03/04 14:37:16.608]         allowable_errors: Optional[Container[Union[int, str]]] = None,
       [2024/03/04 14:37:16.608]         parse_write_concern_error: bool = False,
       [2024/03/04 14:37:16.608]     ) -> None:
       [2024/03/04 14:37:16.608]         """Check the response to a command for errors."""
       [2024/03/04 14:37:16.608]         if "ok" not in response:
       [2024/03/04 14:37:16.608]             # Server didn't recognize our message as a command.
       [2024/03/04 14:37:16.608]             raise OperationFailure(
       [2024/03/04 14:37:16.608]                 response.get("$err"),  # type: ignore[arg-type]
       [2024/03/04 14:37:16.608]                 response.get("code"),
       [2024/03/04 14:37:16.608]                 response,
       [2024/03/04 14:37:16.608]                 max_wire_version,
       [2024/03/04 14:37:16.608]             )
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608]         if parse_write_concern_error and "writeConcernError" in response:
       [2024/03/04 14:37:16.608]             _error = response["writeConcernError"]
       [2024/03/04 14:37:16.608]             _labels = response.get("errorLabels")
       [2024/03/04 14:37:16.608]             if _labels:
       [2024/03/04 14:37:16.608]                 _error.update({"errorLabels": _labels})
       [2024/03/04 14:37:16.608]             _raise_write_concern_error(_error)
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608]         if response["ok"]:
       [2024/03/04 14:37:16.608]             return
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608]         details = response
       [2024/03/04 14:37:16.608]         # Mongos returns the error details in a 'raw' object
       [2024/03/04 14:37:16.608]         # for some errors.
       [2024/03/04 14:37:16.608]         if "raw" in response:
       [2024/03/04 14:37:16.608]             for shard in response["raw"].values():
       [2024/03/04 14:37:16.608]                 # Grab the first non-empty raw error from a shard.
       [2024/03/04 14:37:16.608]                 if shard.get("errmsg") and not shard.get("ok"):
       [2024/03/04 14:37:16.608]                     details = shard
       [2024/03/04 14:37:16.608]                     break
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608]         errmsg = details["errmsg"]
       [2024/03/04 14:37:16.608]         code = details.get("code")
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608]         # For allowable errors, only check for error messages when the code is not
       [2024/03/04 14:37:16.608]         # included.
       [2024/03/04 14:37:16.608]         if allowable_errors:
       [2024/03/04 14:37:16.608]             if code is not None:
       [2024/03/04 14:37:16.608]                 if code in allowable_errors:
       [2024/03/04 14:37:16.608]                     return
       [2024/03/04 14:37:16.608]             elif errmsg in allowable_errors:
       [2024/03/04 14:37:16.608]                 return
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608]         # Server is "not primary" or "recovering"
       [2024/03/04 14:37:16.608]         if code is not None:
       [2024/03/04 14:37:16.608]             if code in _NOT_PRIMARY_CODES:
       [2024/03/04 14:37:16.608]                 raise NotPrimaryError(errmsg, response)
       [2024/03/04 14:37:16.608]         elif HelloCompat.LEGACY_ERROR in errmsg or "node is recovering" in errmsg:
       [2024/03/04 14:37:16.608]             raise NotPrimaryError(errmsg, response)
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608]         # Other errors
       [2024/03/04 14:37:16.608]         # findAndModify with upsert can raise duplicate key error
       [2024/03/04 14:37:16.608]         if code in (11000, 11001, 12582):
       [2024/03/04 14:37:16.608]             raise DuplicateKeyError(errmsg, code, response, max_wire_version)
       [2024/03/04 14:37:16.608]         elif code == 50:
       [2024/03/04 14:37:16.608]             raise ExecutionTimeout(errmsg, code, response, max_wire_version)
       [2024/03/04 14:37:16.608]         elif code == 43:
       [2024/03/04 14:37:16.608]             raise CursorNotFound(errmsg, code, response, max_wire_version)
       [2024/03/04 14:37:16.608]     
       [2024/03/04 14:37:16.608] >       raise OperationFailure(errmsg, code, response, max_wire_version)
       [2024/03/04 14:37:16.608] E       pymongo.errors.OperationFailure: Transaction a1d206f1-986c-4975-b3c5-53e1c4a22665:1 was aborted on statement 0 due to: a non-retryable snapshot error :: caused by :: Database mongos-unpin-db has undergone a catalog change operation at time { : Timestamp(1709584519, 5) } and no longer satisfies the requirements for the current transaction which requires { : Timestamp(1709584518, 40) }. Transaction will be aborted., full error: {'ok': 0.0, 'errmsg': 'Transaction a1d206f1-986c-4975-b3c5-53e1c4a22665:1 was aborted on statement 0 due to: a non-retryable snapshot error :: caused by :: Database mongos-unpin-db has undergone a catalog change operation at time { : Timestamp(1709584519, 5) } and no longer satisfies the requirements for the current transaction which requires { : Timestamp(1709584518, 40) }. Transaction will be aborted.', 'code': 272, 'codeName': 'MigrationConflict', 'operationTime': Timestamp(1709584519, 8), '$clusterTime': {'clusterTime': Timestamp(1709584519, 8), 'signature': {'hash': b'\\\x07\x9f\xf8SLz\x83\xa36\x9a\x9c\xa7\x06\xd2,\xeejCU', 'keyId': 7342606618145587224}}, 'errorLabels': ['TransientTransactionError']}
       [2024/03/04 14:37:16.608] pymongo/helpers.py:230: OperationFailure
      

            Assignee:
            jib.adegunloye@mongodb.com Jib Adegunloye
            Reporter:
            steve.silvester@mongodb.com Steve Silvester
            Votes:
            0 Vote for this issue
            Watchers:
            2 Start watching this issue

              Created:
              Updated:
              Resolved: