rust-lang / rust-lang/ssh2-rs

Dropping ssh connection blocks forever

Open
#165 8 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
Rust
Stars
566
Forks
163
Avg merge
4h 51m
Merged PRs (30d)
2

Description

I occasionally observe that dropping a ssh2::Channel blocks forever, with the following backtrace:

#0  0x00007f676ec29abf in poll () from /usr/lib/libc.so.6
#1  0x00005630c9252d93 in _libssh2_wait_socket (session=0x7f6748001490, start_time=1581613572) at libssh2/src/session.c:641
#2  0x00005630c924057a in libssh2_channel_free (channel=0x5630cbcfcc10) at libssh2/src/channel.c:2657
#3  0x00005630c922b0b2 in <ssh2::channel::ChannelInner as core::ops::drop::Drop>::drop (self=0x5630cbced610) at /home/jon/.cargo/registry/src/github.com-1ecc6299db9ec823/ssh2-0.7.1/src/channel.rs:477

It seems to happen only when a remote command crashes for some reason, like if it is killed by the OOM killer or otherwise dies from a signal. Not sure if this is a known problem and some special steps are needed to exit cleanly in that case?

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

Start at ssh2-0.7.1/src/channel.rs:477 and compare the Drop path with libssh2_channel_free in libssh2/src/channel.c:2657. Trace _libssh2_wait_socket in libssh2/src/session.c:641 while reproducing a remote command that dies unexpectedly. Done means identifying why cleanup waits forever and documenting or testing the corrected behavior.

Written by the indexing model from the issue text.

Assessment

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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.