Mark maxConnecting unified CMAP tests as flaky

XMLWordPrintableJSON

    • 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:

      The following five tests in test.test_connection_monitoring.TestCMAP.test_connection_monitoring... are flaky due to their use of concurrent threads and tight timing windows: pool_checkout_custom_maxConnecting_is_enforced, pool_checkout_maxConnecting_is_enforced, pool_checkout_maxConnecting_timeout, pool_checkout_minPoolSize_connection_maxConnecting, and pool_checkout_returned_connection_maxConnecting.

      The flakiness is worse on PyPy, PyOpenSSL, and free-threaded runs.

      Link to task:

      https://spruce.corp.mongodb.com/task/mongo_python_driver_pyopenssl_rhel8_test_standard_latest_python3.14t_sync_noauth_ssl_replica_set_cov_patch_9bf980202dd19a079d4affa022946cf133de347a_6a8eedc06842fe0007701a9d_26_08_26_13_44_39/test-html-log?execution=0&testName=f92471cbd55b2b2e987dd81476a84105#L0

      Context of when and why the failure occurred:

      See above.

      Stack trace:

      
      
      [2026/08/26 07:14:46.911] FAILURE: AssertionError: Didn't ever find 1 <class 'pymongo.monitoring.ConnectionCheckOutFailedEvent'> event(s) ()
      [2026/08/26 07:14:46.911] self = <test.test_connection_monitoring.TestCMAP testMethod=test_connection_monitoring_pool_checkout_maxConnecting_timeout_waiting_on_maxConnecting_is_limited_by_WaitQueueTimeoutMS>
      [2026/08/26 07:14:46.911]     def run_scenario(self):
      [2026/08/26 07:14:46.911] >       self.run_scenario(scenario_def, test)
      [2026/08/26 07:14:46.911] test/test_connection_monitoring.py:451: 
      [2026/08/26 07:14:46.911] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      [2026/08/26 07:14:46.911] test/test_connection_monitoring.py:282: in run_scenario
      [2026/08/26 07:14:46.911]     self.run_operations(test["operations"])
      [2026/08/26 07:14:46.911] test/test_connection_monitoring.py:172: in run_operations
      [2026/08/26 07:14:46.911]     self.run_operation(op)
      [2026/08/26 07:14:46.911] test/test_connection_monitoring.py:166: in run_operation
      [2026/08/26 07:14:46.911]     meth(op)
      [2026/08/26 07:14:46.911] test/test_connection_monitoring.py:120: in wait_for_event
      [2026/08/26 07:14:46.911]     wait_until(
      [2026/08/26 07:14:46.911] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
      [2026/08/26 07:14:46.911]     def wait_until(predicate, success_description, timeout=10):
      [2026/08/26 07:14:46.911]         """Wait up to 10 seconds (by default) for predicate to be true.
      [2026/08/26 07:14:46.911]     
      [2026/08/26 07:14:46.911]         E.g.:
      [2026/08/26 07:14:46.911]     
      [2026/08/26 07:14:46.911]             wait_until(lambda: client.primary == ('a', 1),
      [2026/08/26 07:14:46.911]                        'connect to the primary')
      [2026/08/26 07:14:46.911]     
      [2026/08/26 07:14:46.911]         If the lambda-expression isn't true after 10 seconds, we raise
      [2026/08/26 07:14:46.911]         AssertionError("Didn't ever connect to the primary").
      [2026/08/26 07:14:46.911]     
      [2026/08/26 07:14:46.911]         Returns the predicate's first true value.
      [2026/08/26 07:14:46.911]         """
      [2026/08/26 07:14:46.911]         start = time.time()
      [2026/08/26 07:14:46.911]         interval = min(float(timeout) / 100, 0.1)
      [2026/08/26 07:14:46.911]         while True:
      [2026/08/26 07:14:46.911]             if iscoroutinefunction(predicate):
      [2026/08/26 07:14:46.911]                 retval = predicate()
      [2026/08/26 07:14:46.911]             else:
      [2026/08/26 07:14:46.911]                 retval = predicate()
      [2026/08/26 07:14:46.911]             if retval:
      [2026/08/26 07:14:46.911]                 return retval
      [2026/08/26 07:14:46.911]     
      [2026/08/26 07:14:46.911]             if time.time() - start > timeout:
      [2026/08/26 07:14:46.911] >               raise AssertionError("Didn't ever %s" % success_description)
      [2026/08/26 07:14:46.911] E               AssertionError: Didn't ever find 1 <class 'pymongo.monitoring.ConnectionCheckOutFailedEvent'> event(s)
      [2026/08/26 07:14:46.911] test/utils.py:80: AssertionError
      
      
      

            Assignee:
            Noah Stapp
            Reporter:
            Noah Stapp
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated: