Skip to content

BUG: Fix exec_command getting stuck on event.wait() on lost connection (#2599) - #2618

Open
Abzaek wants to merge 5 commits into
paramiko:mainfrom
Abzaek:fix/event-wait-timeout
Open

Abzaek wants to merge 5 commits into
paramiko:mainfrom
Abzaek:fix/event-wait-timeout

Conversation

@Abzaek

@Abzaek Abzaek commented May 17, 2026

Copy link
Copy Markdown

Fixes #2599

Summary

Channel._wait_for_event previously called self.event.wait() with no timeout, which could block forever if the underlying transport died without ever setting the event. This change adds an optional timeout parameter (defaulting to None to preserve the existing block-forever behavior), allowing callers to bound how long they wait.

Test plan

  • New tests in tests/test_channelfile.py verify the timeout kwarg is accepted and that a short timeout returns promptly.
  • Full existing test suite still passes (pytest tests/ -x -q).

Abzaek added 5 commits May 17, 2026 10:58
paramiko#2599)

Adds an optional ``timeout`` parameter to ``Channel._wait_for_event`` so
callers can bound how long they wait on a channel event. The default
remains ``None`` (block forever), preserving backwards compatibility.

Signed-off-by: Abdulazez A. <[email protected]>
Signed-off-by: Abdulazez A. <[email protected]>
Signed-off-by: Abdulazez A. <[email protected]>
Signed-off-by: Abdulazez A. <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[BUG] - SSH exec_command gets stuck while waiting for threading Event

1 participant