Skip to content

Commit a1cb1ac

Browse files
committed
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.
1 parent 6367351 commit a1cb1ac

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

java/org/apache/coyote/http2/Stream.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1052,7 +1052,7 @@ public final int doRead(ApplicationBufferHandler applicationBufferHandler)
10521052
throw new IOException(sm.getString("stream.inputBuffer.reset"));
10531053
}
10541054

1055-
if (inBuffer.position() == 0) {
1055+
if (inBuffer.position() == 0 && isActive() && !isInputFinished()) {
10561056
String msg = sm.getString("stream.inputBuffer.readTimeout");
10571057
StreamException se = new StreamException(
10581058
msg, Http2Error.ENHANCE_YOUR_CALM, getIdAsInt());

webapps/docs/changelog.xml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@
138138
Ensure enough buffer space when using TLS with NIO2 by using the main
139139
read buffer to store additional decrypted data. (remm)
140140
</fix>
141+
<fix>
142+
Verify HTTP/2 stream is still writable before assuming a timeout
143+
occurred. (remm)
144+
</fix>
141145
</changelog>
142146
</subsection>
143147
<subsection name="WebSocket">

0 commit comments

Comments
 (0)