From: Colin Watson Date: Sun, 22 Feb 2026 13:58:54 +0000 Subject: Clean up threads in sftp_server fixture The `sftp_server` fixture never cleaned up the server thread; this was easily visible by watching `htop` while running the test suite. On some underpowered architectures this could eventually result in `RuntimeError: can't start new thread`. This was the root cause of https://bugs.debian.org/1127663. Forwarded: https://github.com/paramiko/paramiko/pull/2577 Bug-Debian: https://bugs.debian.org/1127663 Last-Update: 2026-02-22 --- tests/conftest.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) Index: paramiko/tests/conftest.py =================================================================== --- paramiko.orig/tests/conftest.py +++ paramiko/tests/conftest.py @@ -94,9 +94,13 @@ def sftp_server(): event.wait(1.0) # Make & yield connection. tc.connect(username="slowdive", password="pygmalion") - yield tc - # TODO: any need for shutdown? Why didn't old suite do so? Or was that the - # point of the "join all threads from threading module" crap in test.py? + try: + yield tc + finally: + tc.close() + ts.close() + socks.close() + sockc.close() @pytest.fixture