[Test Failure] test.test_discovery_and_monitoring.TestPoolBackpressure.test_connection_pool_is_not_cleared

XMLWordPrintableJSON

    • Type: Build Failure
    • Resolution: Unresolved
    • Priority: Major - P3
    • None
    • Affects Version/s: None
    • Component/s: None
    • None
    • Python Drivers
    • None
    • None
    • None
    • None
    • None
    • None

      Name of Failure:

      test.test_discovery_and_monitoring.TestPoolBackpressure.test_connection_pool_is_not_cleared

      Link to task:

      https://spruce.corp.mongodb.com/task/mongo_python_driver_pyopenssl_macos_test_standard_rapid_python3.12_sync_noauth_ssl_replica_set_patch_06041261cb9020e4279db749f56a476156820e02_6a26d0d9b9e75f0007a89bfa_26_06_08_14_25_57/tests?execution=0&sorts=STATUS%3AASC

      Context of when and why the failure occurred:

      Has been failing consistently.

      Stack trace:

      [2026/06/08 07:48:20.861] FAILURE: AssertionError: 3 != 0 ()
      [2026/06/08 07:48:20.861] self = <test.test_discovery_and_monitoring.TestPoolBackpressure testMethod=test_connection_pool_is_not_cleared>
      [2026/06/08 07:48:20.861]     @client_context.require_version_min(7, 0, 0)
      [2026/06/08 07:48:20.861]     def test_connection_pool_is_not_cleared(self):
      [2026/06/08 07:48:20.861]         listener = CMAPListener()
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         # Create a client that listens to CMAP events, with maxConnecting=100.
      [2026/06/08 07:48:20.861]         client = self.rs_or_single_client(maxConnecting=100, event_listeners=[listener])
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         # Enable the ingress rate limiter.
      [2026/06/08 07:48:20.861]         client.admin.command(
      [2026/06/08 07:48:20.861]             "setParameter", 1, ingressConnectionEstablishmentRateLimiterEnabled=True
      [2026/06/08 07:48:20.861]         )
      [2026/06/08 07:48:20.861]         client.admin.command("setParameter", 1, ingressConnectionEstablishmentRatePerSec=20)
      [2026/06/08 07:48:20.861]         client.admin.command("setParameter", 1, ingressConnectionEstablishmentBurstCapacitySecs=1)
      [2026/06/08 07:48:20.861]         client.admin.command("setParameter", 1, ingressConnectionEstablishmentMaxQueueDepth=1)
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         # Disable the ingress rate limiter on teardown.
      [2026/06/08 07:48:20.861]         # Sleep for 1 second before disabling to avoid the rate limiter.
      [2026/06/08 07:48:20.861]         def teardown():
      [2026/06/08 07:48:20.861]             time.sleep(1)
      [2026/06/08 07:48:20.861]             client.admin.command(
      [2026/06/08 07:48:20.861]                 "setParameter", 1, ingressConnectionEstablishmentRateLimiterEnabled=False
      [2026/06/08 07:48:20.861]             )
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         self.addCleanup(teardown)
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         # Make sure the collection has at least one document.
      [2026/06/08 07:48:20.861]         client.test.test.delete_many({})
      [2026/06/08 07:48:20.861]         client.test.test.insert_one({})
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         # Run a slow operation to tie up the connection.
      [2026/06/08 07:48:20.861]         def target():
      [2026/06/08 07:48:20.861]             try:
      [2026/06/08 07:48:20.861]                 client.test.test.find_one({"$where": delay(0.1)})
      [2026/06/08 07:48:20.861]             except ConnectionFailure:
      [2026/06/08 07:48:20.861]                 pass
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         # Run 100 parallel operations that contend for connections.
      [2026/06/08 07:48:20.861]         tasks = []
      [2026/06/08 07:48:20.861]         for _ in range(100):
      [2026/06/08 07:48:20.861]             tasks.append(ConcurrentRunner(target=target))
      [2026/06/08 07:48:20.861]         for t in tasks:
      [2026/06/08 07:48:20.861]             t.start()
      [2026/06/08 07:48:20.861]         for t in tasks:
      [2026/06/08 07:48:20.861]             t.join()
      [2026/06/08 07:48:20.861]     
      [2026/06/08 07:48:20.861]         # Verify there were at least 10 connection checkout failed event but no pool cleared events.
      [2026/06/08 07:48:20.861]         self.assertGreater(len(listener.events_by_type(ConnectionCheckOutFailedEvent)), 10)
      [2026/06/08 07:48:20.861] >       self.assertEqual(len(listener.events_by_type(PoolClearedEvent)), 0)
      [2026/06/08 07:48:20.861] E       AssertionError: 3 != 0
      [2026/06/08 07:48:20.861] test/test_discovery_and_monitoring.py:498: AssertionError
      

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

              Created:
              Updated: