Commit 1822765
tests: fix command-queue race in mock-ssh-server exec handling (#72)
Handler.run() creates the per-channel command queue with a
check-then-assign while paramiko's transport thread creates it with
setdefault() and puts the command into it from
check_channel_exec_request(). When the exec request lands inside the
window, run() replaces the queue that already holds the command,
handle_client() blocks on Queue.get() forever and the client never
receives an exit status.
This is the intermittent CI hang: every _execute()-based operation
(cp_file, checksum, the move fallback) rolls these dice, and
test_concurrency_for_raw_commands rolls them 16 at a time. Confirmed
by the faulthandler dump from the first run with #71 merged
(handle_client threads parked on Queue.get with the client waiting),
and reproduced deterministically by widening the window with a 5ms
sleep: upstream logic deadlocks on the first round, the same logic
with an atomic setdefault() survives, with or without the delay.
mock-ssh-server is unmaintained, so the method is patched in conftest
instead of upstream.
Co-authored-by: Claude Fable 5 <noreply@anthropic.com>1 parent 1dcfc1a commit 1822765
1 file changed
Lines changed: 28 additions & 0 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
0 commit comments