Skip to content

Commit

Permalink
GH-420: avoid spurious exceptions on closing forwarded channel
Browse files Browse the repository at this point in the history
Fix Nio2Session.doCloseGracefully(): before calling
AsynchronousSocketChannel.shutdownOutput(), check that the socket is
still open, and if we get an IOException all the same, log it with
TRACE level. See also comments in doShutdownOutputStream().

Bug: #420
  • Loading branch information
tomaswolf committed Oct 6, 2023
1 parent c49e82c commit 9b485a7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
* [GH-407](https://github.com/apache/mina-sshd/issues/407) (Regression in 2.10.0) SFTP performance fix: override `FilterOutputStream.write(byte[], int, int)`.
* [GH-410](https://github.com/apache/mina-sshd/issues/410) Fix a race condition to ensure `SSH_MSG_CHANNEL_EOF` is always sent before `SSH_MSG_CHANNEL_CLOSE`.
* [GH-414](https://github.com/apache/mina-sshd/issues/414) Fix error handling while flushing queued packets at end of KEX.
* [GH-420](https://github.com/apache/mina-sshd/issues/420) Fix wrong log level on closing an `Nio2Session`.

* [SSHD-789](https://issues.apache.org/jira/browse/SSHD-789) Fix detection of Android O/S from system properties.
* [SSHD-1259](https://issues.apache.org/jira/browse/SSHD-1259) Consider all applicable host keys from the known_hosts files.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -224,9 +224,11 @@ protected CloseFuture doCloseGracefully() {
.run(closeId, () -> {
try {
AsynchronousSocketChannel socket = getSocket();
socket.shutdownOutput();
if (socket.isOpen()) {
socket.shutdownOutput();
}
} catch (IOException e) {
info("doCloseGracefully({}) {} while shutting down output: {}",
log.trace("doCloseGracefully({}) {} while shutting down output: {}",
this, e.getClass().getSimpleName(), e.getMessage(), e);
}
}).build()
Expand Down

0 comments on commit 9b485a7

Please sign in to comment.