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

Test Failure - test.test_monitor.TestMonitor.test_cleanup_executors_on_client_del fails on PyPy

    • 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.test_monitor.TestMonitor.test_cleanup_executors_on_client_del

      Link to task:

      https://spruce.mongodb.com/task/mongo_python_driver_test_rhel8_pypy3.10_cov_no_c_test_4.4_sharded_cluster_noauth_nossl_sync_async_98b656f286790ecbfc98acd5bbdf5bb128ad2804_25_04_08_12_52_55?execution=0&sortBy=STATUS&sortDir=ASC

      Context of when and why the failure occurred:

      Stack trace:

       [2025/04/08 06:16:51.689] FAILURE: AssertionError: Didn't ever unregister executor: pymongo_events_thread ()
       [2025/04/08 06:16:51.689] self = <test.test_monitor.TestMonitor testMethod=test_cleanup_executors_on_client_del>
       [2025/04/08 06:16:51.689]     def test_cleanup_executors_on_client_del(self):
       [2025/04/08 06:16:51.689]         with warnings.catch_warnings(record=True) as w:
       [2025/04/08 06:16:51.689]             warnings.simplefilter("always")
       [2025/04/08 06:16:51.689]             client = self.create_client()
       [2025/04/08 06:16:51.689]             executors = get_executors(client)
       [2025/04/08 06:16:51.689]             self.assertEqual(len(executors), 4)
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]             # Each executor stores a weakref to itself in _EXECUTORS.
       [2025/04/08 06:16:51.689]             executor_refs = [(r, r()._name) for r in _EXECUTORS.copy() if r() in executors]
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]             del executors
       [2025/04/08 06:16:51.689]             del client
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]             for ref, name in executor_refs:
       [2025/04/08 06:16:51.689] >               wait_until(partial(unregistered, ref), f"unregister executor: {name}", timeout=5)
       [2025/04/08 06:16:51.689] test/test_monitor.py:74: 
       [2025/04/08 06:16:51.689] _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
       [2025/04/08 06:16:51.689] predicate = functools.partial(<function unregistered at 0x0000000017ef4660>, <weakref at 0x00000000107318c0; to 'PeriodicExecutor'>)
       [2025/04/08 06:16:51.689] success_description = 'unregister executor: pymongo_events_thread', timeout = 5
       [2025/04/08 06:16:51.689]     def wait_until(predicate, success_description, timeout=10):
       [2025/04/08 06:16:51.689]         """Wait up to 10 seconds (by default) for predicate to be true.
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]         E.g.:
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]             wait_until(lambda: client.primary == ('a', 1),
       [2025/04/08 06:16:51.689]                        'connect to the primary')
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]         If the lambda-expression isn't true after 10 seconds, we raise
       [2025/04/08 06:16:51.689]         AssertionError("Didn't ever connect to the primary").
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]         Returns the predicate's first true value.
       [2025/04/08 06:16:51.689]         """
       [2025/04/08 06:16:51.689]         start = time.time()
       [2025/04/08 06:16:51.689]         interval = min(float(timeout) / 100, 0.1)
       [2025/04/08 06:16:51.689]         while True:
       [2025/04/08 06:16:51.689]             if iscoroutinefunction(predicate):
       [2025/04/08 06:16:51.689]                 retval = predicate()
       [2025/04/08 06:16:51.689]             else:
       [2025/04/08 06:16:51.689]                 retval = predicate()
       [2025/04/08 06:16:51.689]             if retval:
       [2025/04/08 06:16:51.689]                 return retval
       [2025/04/08 06:16:51.689]     
       [2025/04/08 06:16:51.689]             if time.time() - start > timeout:
       [2025/04/08 06:16:51.689] >               raise AssertionError("Didn't ever %s" % success_description)
       [2025/04/08 06:16:51.689] E               AssertionError: Didn't ever unregister executor: pymongo_events_thread
       [2025/04/08 06:16:51.689] test/utils.py:77: 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: