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

Test Failure - test.asynchronous.test_concurrency.TestAsyncConcurrency.test_concurrency

    • Type: Icon: Build Failure Build Failure
    • Resolution: Done
    • Priority: Icon: Unknown Unknown
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • 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?
    • None
    • None
    • None
    • None
    • None
    • None

      Name of Failure:

      test.asynchronous.test_concurrency.TestAsyncConcurrency.test_concurrency

      Link to task:

      https://spruce.mongodb.com/task/mongo_python_driver_other_hosts_rhel8_zseries_test_6.0_standalone_auth_ssl_async_patch_e6a4a7145eccb0b6c76c84aa539f29b40f3424b3_67fec6138250720007260f95_25_04_15_20_49_09?execution=0&sortBy=STATUS&sortDir=ASC

      Context of when and why the failure occurred:

      test.asynchronous.test_concurrency.TestAsyncConcurrency.test_concurrency is inconsistent across platforms and host conditions. Its threshold should be lowered to ensure that failures represent code slowdowns and not platform variance.

      Stack trace:

       [2025/04/15 16:32:19.963] FAILURE: AssertionError: 51.85073760991477 not greater than or equal to 75 ()
       [2025/04/15 16:32:19.963] self = <test.asynchronous.test_concurrency.TestAsyncConcurrency testMethod=test_concurrency>
       [2025/04/15 16:32:19.963]     async def test_concurrency(self):
       [2025/04/15 16:32:19.963]         tasks = []
       [2025/04/15 16:32:19.963]         iterations = 5
       [2025/04/15 16:32:19.963]     
       [2025/04/15 16:32:19.963]         client = await self.async_single_client()
       [2025/04/15 16:32:19.963]         await client.db.test.drop()
       [2025/04/15 16:32:19.963]         await client.db.test.insert_one({"x": 1})
       [2025/04/15 16:32:19.963]     
       [2025/04/15 16:32:19.963]         start = time.time()
       [2025/04/15 16:32:19.963]     
       [2025/04/15 16:32:19.963]         for _ in range(iterations):
       [2025/04/15 16:32:19.963]             await self._task(client)
       [2025/04/15 16:32:19.963]     
       [2025/04/15 16:32:19.963]         sequential_time = time.time() - start
       [2025/04/15 16:32:19.963]         start = time.time()
       [2025/04/15 16:32:19.963]     
       [2025/04/15 16:32:19.963]         for i in range(iterations):
       [2025/04/15 16:32:19.963]             tasks.append(self._task(client))
       [2025/04/15 16:32:19.963]     
       [2025/04/15 16:32:19.963]         await asyncio.gather(*tasks)
       [2025/04/15 16:32:19.963]         concurrent_time = time.time() - start
       [2025/04/15 16:32:19.963]     
       [2025/04/15 16:32:19.963]         percent_faster = (sequential_time - concurrent_time) / concurrent_time * 100
       [2025/04/15 16:32:19.963]         # We expect the concurrent tasks to be at least 75% faster on all platforms as a conservative benchmark
       [2025/04/15 16:32:19.963] >       self.assertGreaterEqual(percent_faster, 75)
       [2025/04/15 16:32:19.963] E       AssertionError: 51.85073760991477 not greater than or equal to 75
       [2025/04/15 16:32:19.963] test/asynchronous/test_concurrency.py:54: AssertionError
      

            Assignee:
            noah.stapp@mongodb.com Noah Stapp
            Reporter:
            noah.stapp@mongodb.com Noah Stapp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: