Skip to content
Permalink
Browse files

Check stream state after wait

Verify HTTP/2 stream is still writable before assuming a timeout
occurred. The reason for bad behavior is a bit unclear (I see it with
logging on and async IO), but the check is inconsistent.
  • Loading branch information
rmaucher committed Mar 8, 2019
1 parent 6367351 commit a1cb1ac77e3a8fec1b00eb0e944842555da14f7d
Showing with 5 additions and 1 deletion.
  1. +1 −1 java/org/apache/coyote/http2/Stream.java
  2. +4 −0 webapps/docs/changelog.xml
@@ -1052,7 +1052,7 @@ public final int doRead(ApplicationBufferHandler applicationBufferHandler)
throw new IOException(sm.getString("stream.inputBuffer.reset"));
}

if (inBuffer.position() == 0) {
if (inBuffer.position() == 0 && isActive() && !isInputFinished()) {
String msg = sm.getString("stream.inputBuffer.readTimeout");
StreamException se = new StreamException(
msg, Http2Error.ENHANCE_YOUR_CALM, getIdAsInt());
@@ -138,6 +138,10 @@
Ensure enough buffer space when using TLS with NIO2 by using the main
read buffer to store additional decrypted data. (remm)
</fix>
<fix>
Verify HTTP/2 stream is still writable before assuming a timeout
occurred. (remm)
</fix>
</changelog>
</subsection>
<subsection name="WebSocket">

0 comments on commit a1cb1ac

Please sign in to comment.
You can’t perform that action at this time.