paramiko / paramiko/paramiko

SSHException when exec_command is run repeatedly

Open
#550 5 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Needs investigation
Dominant language
Python
Stars
9.9k
Forks
2.1k
PR merge metrics
No merged PRs in 30d

Description

I am working with the pygerrit library which uses paramiko to run commands over SSH. I am facing a problem where exec_command throws SSHException if it's called repeatedly in quick succession.

It can be consistently reproduced when connecting to a gerrit instance running on a VM on my laptop but never when it's connecting the actual remote gerrit server.

I think this could be related to the exec_command returning the result too fast (if the network latencies are too low) because the problem disappears if an artificial latency is introduced between the host and the VM (using ipfw).

On enabling logging in paramiko, following logs can be seen for a successful query

DEB [20150630-12:57:45.817] thr=1   paramiko.transport: [chan 10] Max packet in: 32768 bytes
DEB [20150630-12:57:45.819] thr=2   paramiko.transport: [chan 10] Max packet out: 32768 bytes
DEB [20150630-12:57:45.819] thr=2   paramiko.transport: Secsh channel 10 opened.
DEB [20150630-12:57:45.824] thr=2   paramiko.transport: [chan 10] Sesch channel 10 request ok
DEB [20150630-12:57:45.827] thr=2   paramiko.transport: [chan 10] EOF received (10)
DEB [20150630-12:57:45.828] thr=2   paramiko.transport: [chan 10] EOF sent (10)

Whereas the one for unsuccessful query is as follows,

DEB [20150630-12:57:47.338] thr=1   paramiko.transport: [chan 11] Max packet in: 32768 bytes
DEB [20150630-12:57:47.339] thr=2   paramiko.transport: [chan 11] Max packet out: 32768 bytes
DEB [20150630-12:57:47.340] thr=2   paramiko.transport: Secsh channel 11 opened.
DEB [20150630-12:57:47.347] thr=2   paramiko.transport: [chan 11] EOF received (11)
DEB [20150630-12:57:47.347] thr=2   paramiko.transport: [chan 11] EOF sent (11)
DEB [20150630-12:57:47.349] thr=2   paramiko.transport: Ignoring message for dead channel 11

Has any one else faced this issue?

Thanks.

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

No source file or test is named. Start at the exec_command entry point and reproduce repeated calls against the local VM while comparing the successful and unsuccessful Paramiko transport logs. Done means identifying the cause of the dead-channel behavior and capturing the regression in a focused test.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
networking
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.