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

Remove noisy Topology has THREADS RUNNING check for main test client

    • Type: Icon: Task Task
    • Resolution: Fixed
    • Priority: Icon: Unknown Unknown
    • 4.1
    • Affects Version/s: None
    • Component/s: Tests
    • None

      In PYTHON-2268, we added a check to print out MongoClients which still have running threads at the end of the test suite. This change has worked great for identifying unclosed clients, however it often produces a false positive for the main test client created by ClientContext. For example:

       [2022/03/10 22:52:17.548]   Topology <Topology <TopologyDescription id: 622a80236291574d05a59959, topology_type: Single, servers: [<ServerDescription ('localhost', 27017) server_type: Standalone, rtt: 0.0005760174894780436>]>> has THREADS RUNNING: [<PeriodicExecutor(name=pymongo_server_monitor_thread) object at 0x7f5b2413eb70>, <PeriodicExecutor(name=pymongo_server_rtt_thread) object at 0x7f5b2414d080>], created at:   File "setup.py", line 345, in <module>
       [2022/03/10 22:52:17.548]     **extra_opts
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/venv-encryption/lib64/python3.6/dist-packages/setuptools/__init__.py", line 153, in setup
       [2022/03/10 22:52:17.549]     return distutils.core.setup(**attrs)
       [2022/03/10 22:52:17.549]   File "/usr/lib64/python3.6/distutils/core.py", line 148, in setup
       [2022/03/10 22:52:17.549]     dist.run_commands()
       [2022/03/10 22:52:17.549]   File "/usr/lib64/python3.6/distutils/dist.py", line 955, in run_commands
       [2022/03/10 22:52:17.549]     self.run_command(cmd)
       [2022/03/10 22:52:17.549]   File "/usr/lib64/python3.6/distutils/dist.py", line 974, in run_command
       [2022/03/10 22:52:17.549]     cmd_obj.run()
       [2022/03/10 22:52:17.549]   File "setup.py", line 122, in run
       [2022/03/10 22:52:17.549]     result = runner.run(suite)
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/test/__init__.py", line 1096, in run
       [2022/03/10 22:52:17.549]     setup()
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/test/__init__.py", line 1020, in setup
       [2022/03/10 22:52:17.549]     client_context.init()
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/test/__init__.py", line 453, in init
       [2022/03/10 22:52:17.549]     self._init_client()
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/test/__init__.py", line 367, in _init_client
       [2022/03/10 22:52:17.549]     **self.default_client_options
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/test/__init__.py", line 307, in _connect
       [2022/03/10 22:52:17.549]     return pymongo.MongoClient(host, port, **kwargs)
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/pymongo/mongo_client.py", line 785, in __init__
       [2022/03/10 22:52:17.549]     srv_max_hosts=srv_max_hosts,
       [2022/03/10 22:52:17.549]   File "/data/mci/508eee3f4e81d8b28e7642006fe1039f/src/pymongo/settings.py", line 77, in __init__
       [2022/03/10 22:52:17.549]     self._stack = "".join(traceback.format_stack())
       [2022/03/10 22:52:18.536] Finished 'shell.exec' in "run tests" in 4m41.901345409s
      

      https://evergreen.mongodb.com/task/mongo_python_driver_tests_all_encryption__platform~awslinux_auth_ssl~auth_ssl_encryption~encryption_test_latest_standalone_225d131c2d3f6f0b4c46c130abb3e1452010ad40_22_03_09_19_13_18

      The issue is that the main client is closed directly before calling print_unclosed_clients() and due to the behavior described in PYTHON-1634 the threads often have yet to shutdown.

      Until PYTHON-1634 or PYTHON-1896 is implemented we should avoid checking the main test client.

            Assignee:
            shane.harvey@mongodb.com Shane Harvey
            Reporter:
            shane.harvey@mongodb.com Shane Harvey
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: