# HG changeset patch # User dfuchs # Date 1525368452 -3600 # Node ID 17cb1166de81faaa52c6ad95564e7e52c2fc1184 # Parent 2294c51eae30b6a24c95d15055c36538164d8544 http-client-branch: Http2Connection should not try to send RST_STREAM if the channel is already closed diff -r 2294c51eae30 -r 17cb1166de81 src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java --- a/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java Wed May 02 15:47:57 2018 +0100 +++ b/src/java.net.http/share/classes/jdk/internal/net/http/Http2Connection.java Thu May 03 18:27:32 2018 +0100 @@ -797,12 +797,22 @@ } void resetStream(int streamid, int code) throws IOException { - Log.logError( - "Resetting stream {0,number,integer} with error code {1,number,integer}", - streamid, code); - ResetFrame frame = new ResetFrame(streamid, code); - sendFrame(frame); - closeStream(streamid); + try { + if (connection.channel().isOpen()) { + // no need to try & send a reset frame if the + // connection channel is already closed. + Log.logError( + "Resetting stream {0,number,integer} with error code {1,number,integer}", + streamid, code); + ResetFrame frame = new ResetFrame(streamid, code); + sendFrame(frame); + } else if (debug.on()) { + debug.log("Channel already closed, no need to reset stream %d", + streamid); + } + } finally { + closeStream(streamid); + } } void closeStream(int streamid) {