Check stream state after wait · apache/tomcat@a1cb1ac · GitHub
Skip to content

Commit

Permalink
Check stream state after wait
Browse files Browse the repository at this point in the history
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 a1cb1ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 1 addition & 1 deletion java/org/apache/coyote/http2/Stream.java
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down
4 changes: 4 additions & 0 deletions webapps/docs/changelog.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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">
Expand Down

0 comments on commit a1cb1ac

Please sign in to comment.