-
Type:
Build Failure
-
Resolution: Unresolved
-
Priority:
Unknown
-
None
-
Affects Version/s: None
-
Component/s: None
-
None
-
None
-
Python Drivers
-
None
-
None
-
None
-
None
-
None
-
None
Name of Failure:
test.asynchronous.test_client_backpressure.AsyncTestClientBackpressure.test_05_overload_errors_with_basebackoffms_override_backoff
Link to task:
Context of when and why the failure occurred:
The absolute check is too sensitive on non-Linux platforms.
Stack trace:
[2026/07/29 08:56:06.358] FAILURE: AssertionError: 0.29387570000000096 not greater than or equal to 0.3 () [2026/07/29 08:56:06.358] self = <test.asynchronous.test_client_backpressure.AsyncTestClientBackpressure testMethod=test_05_overload_errors_with_basebackoffms_override_backoff> [2026/07/29 08:56:06.358] random_func = <MagicMock name='random' id='2459662818464'> [2026/07/29 08:56:06.358] @unittest.skipIf( [2026/07/29 08:56:06.358] sys.platform == "darwin", [2026/07/29 08:56:06.358] "externalClientBaseBackoffMS is not supported on macOS", [2026/07/29 08:56:06.358] ) [2026/07/29 08:56:06.358] @patch("random.random") [2026/07/29 08:56:06.358] @async_client_context.require_version_min(9, 0, 0, -1) [2026/07/29 08:56:06.358] @async_client_context.require_failCommand_appName [2026/07/29 08:56:06.358] async def test_05_overload_errors_with_basebackoffms_override_backoff(self, random_func): [2026/07/29 08:56:06.358] # Drivers should test that overload errors with `baseBackoffMS` override the default backoff duration. [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 1. Let `client` be a `MongoClient`. [2026/07/29 08:56:06.358] client = self.client [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 2. Let `coll` be a collection. [2026/07/29 08:56:06.358] coll = client.test.test [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 3. Configure the random number generator used for exponential backoff jitter to always return a number as [2026/07/29 08:56:06.358] # close as possible to `1`. [2026/07/29 08:56:06.358] random_func.return_value = 1 [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 4. Configure the following failPoint: [2026/07/29 08:56:06.358] fail_point = dict( [2026/07/29 08:56:06.358] mode="alwaysOn", [2026/07/29 08:56:06.358] data=dict( [2026/07/29 08:56:06.358] failCommands=["insert"], [2026/07/29 08:56:06.358] errorCode=462, [2026/07/29 08:56:06.358] errorLabels=["SystemOverloadedError", "RetryableError"], [2026/07/29 08:56:06.358] appName=self.app_name, [2026/07/29 08:56:06.358] ), [2026/07/29 08:56:06.358] ) [2026/07/29 08:56:06.358] async with self.fail_point(fail_point): [2026/07/29 08:56:06.358] # 5. Insert the document `{ a: 1 }`. Expect that the command errors. Measure the duration of the command [2026/07/29 08:56:06.358] # execution. [2026/07/29 08:56:06.358] start0 = perf_counter() [2026/07/29 08:56:06.358] with self.assertRaises(OperationFailure): [2026/07/29 08:56:06.358] await coll.insert_one({"a": 1}) [2026/07/29 08:56:06.358] end0 = perf_counter() [2026/07/29 08:56:06.358] exponential_backoff_time = end0 - start0 [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 6. Run the following command to set up `baseBackoffMS` on overload errors. [2026/07/29 08:56:06.358] try: [2026/07/29 08:56:06.358] await client.admin.command("setParameter", 1, externalClientBaseBackoffMS=50) [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 7. Execute step 5 again. [2026/07/29 08:56:06.358] start1 = perf_counter() [2026/07/29 08:56:06.358] with self.assertRaises(OperationFailure) as ctx: [2026/07/29 08:56:06.358] await coll.insert_one({"a": 1}) [2026/07/29 08:56:06.358] end1 = perf_counter() [2026/07/29 08:56:06.358] with_base_backoff_ms_time = end1 - start1 [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 8. Assert the server attached `baseBackoffMS` to the error and the driver parsed it. [2026/07/29 08:56:06.358] self.assertEqual(ctx.exception._base_backoff_ms, 50) [2026/07/29 08:56:06.358] finally: [2026/07/29 08:56:06.358] # 9. Run the following command to disable `baseBackoffMS` on overload errors. [2026/07/29 08:56:06.358] await client.admin.command("setParameter", 1, externalClientBaseBackoffMS=0) [2026/07/29 08:56:06.358] [2026/07/29 08:56:06.358] # 10. Assert absolute bounds on each run's duration. [2026/07/29 08:56:06.358] # A run can never be faster than the sum of its backoffs. [2026/07/29 08:56:06.358] # With jitter pinned to 1, the default backoffs are 0.2 + 0.4 = 0.6s [2026/07/29 08:56:06.358] # and the baseBackoffMS=50 backoffs are 0.1 + 0.2 = 0.3s. [2026/07/29 08:56:06.358] self.assertGreaterEqual(exponential_backoff_time, 0.6) [2026/07/29 08:56:06.358] > self.assertGreaterEqual(with_base_backoff_ms_time, 0.3) [2026/07/29 08:56:06.358] E AssertionError: 0.29387570000000096 not greater than or equal to 0.3 [2026/07/29 08:56:06.358] test\asynchronous\test_client_backpressure.py:358: AssertionError