Debian Codegraph @

debian/patches/sftp-server-fixture-cleanup-threads.patch

raw
1 From: Colin Watson <[email protected]>
2 Date: Sun, 22 Feb 2026 13:58:54 +0000
3 Subject: Clean up threads in sftp_server fixture
4
5 The `sftp_server` fixture never cleaned up the server thread; this was
6 easily visible by watching `htop` while running the test suite.
7
8 On some underpowered architectures this could eventually result in
9 `RuntimeError: can't start new thread`. This was the root cause of
10 https://bugs.debian.org/1127663.
11
12 Forwarded: https://github.com/paramiko/paramiko/pull/2577
13 Bug-Debian: https://bugs.debian.org/1127663
14 Last-Update: 2026-02-22
15 ---
16 tests/conftest.py | 10 +++++++---
17 1 file changed, 7 insertions(+), 3 deletions(-)
18
19 Index: paramiko/tests/conftest.py
20 ===================================================================
21 --- paramiko.orig/tests/conftest.py
22 +++ paramiko/tests/conftest.py
23 @@ -94,9 +94,13 @@ def sftp_server():
24 event.wait(1.0)
25 # Make & yield connection.
26 tc.connect(username="slowdive", password="pygmalion")
27 - yield tc
28 - # TODO: any need for shutdown? Why didn't old suite do so? Or was that the
29 - # point of the "join all threads from threading module" crap in test.py?
30 + try:
31 + yield tc
32 + finally:
33 + tc.close()
34 + ts.close()
35 + socks.close()
36 + sockc.close()
37
38
39 @pytest.fixture