-
Notifications
You must be signed in to change notification settings - Fork 87
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
close method on SSHSession.java #152
Comments
The input stream used by What version are you using? |
I'm using a fork from master branch (5 commits behind), but it shares same @Override
public <DataBufType> int readData(BaseReader<DataBufType> rdr, DataBufType buf,
int offset, int length) throws IOException {
watchdog.watch();
try {
int read = rdr.read(buf, offset, length);
if (read == -1) {
trace("end of input (-1)");
throw new IOException("Session closed");
} else {
ByteBuffer data = rdr.encode(buf, offset, read);
// FIXME: this is broken, readData may be called repeatedly
// on the same data due to buffering and mark/reset calls
for (final IOSubscriber sub: ioSubscribers) {
sub.inputRaw(data);
}
}
return read;
} finally {
watchdog.done();
}
} Below are jstack result on hanging thread
|
There are definitely bugs (more than one, I think) in how readTimeout is handled, but I'm not sure if this is what you are complaining about. With the default readTimeout, the session would wait for incoming data pretty much indefinitely, or until the connection is terminated; you write that you have "abnormal disconnection" - what does that mean? If there is a disconnection and the client knows about it (i.e. the operating system knows about it), everything should just work in the sense that the session terminates; otherwise, if the client does not know about the disconnection, it just waits, and there is hardly anything else that it can do (except for timing out on a readTimeout if it has been set - but that does not work currently, as I wrote). |
Hello. I have a question on SSHSession.java
I found that close() method on SSHSession doesn't close InputStream.
Is there any reason?
It may cause thread hang on readData() method since no InputStream closed after rdr.read() called.
P.S. I appreciate your efforts in this project :)
The text was updated successfully, but these errors were encountered: