Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix reading on a closed channel throw UnexpectedEof error #461

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

uuhan
Copy link

@uuhan uuhan commented Feb 7, 2025

Stop reading on a closed channel and stop it's keepalive timer.

This may cause an Error after a session closed:

SshError(IO(Custom { kind: UnexpectedEof, error: "early eof" }))

I encountered in my workhorse project, and also find a related issue: #253

After a long trace in the source code, found that this is caused by

  1. read data after channel closed:

let n = cipher::read(&mut stream_read, &mut buffer, &mut *cipher).await?;

stream.read_exact(&mut len).await?;

(insufficient data to be read)
this caused the "early eof" issue.

  1. still doing keepalive after channel closed:

self.keepalive_request()?;

this caused the "broken pipe" issue.

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.

1 participant