This is an automated email from the ASF dual-hosted git repository.
markt pushed a commit to branch 10.1.x
in repository https://gitbox.apache.org/repos/asf/tomcat.git
The following commit(s) were added to refs/heads/10.1.x by this push:
new aa7ff731ec Fix 66530 - Regression in fix for BZ 66442. Ensure count is
decremented
aa7ff731ec is described below
commit aa7ff731ec25f915c124592c8d1d1f6ee069cc22
Author: Mark Thomas <[email protected]>
AuthorDate: Fri Mar 17 09:23:05 2023 +0000
Fix 66530 - Regression in fix for BZ 66442. Ensure count is decremented
https://bz.apache.org/bugzilla/show_bug.cgi?id=66530
---
.../apache/coyote/http2/Http2AsyncUpgradeHandler.java | 17 ++++-------------
java/org/apache/coyote/http2/Http2UpgradeHandler.java | 15 ++++++++++-----
webapps/docs/changelog.xml | 7 +++++++
3 files changed, 21 insertions(+), 18 deletions(-)
diff --git a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
index 629924e02e..5eee67451c 100644
--- a/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2AsyncUpgradeHandler.java
@@ -203,7 +203,7 @@ public class Http2AsyncUpgradeHandler extends
Http2UpgradeHandler {
}
}
if (endOfStream) {
- stream.sentEndOfStream();
+ sentEndOfStream(stream);
}
}
@@ -227,10 +227,7 @@ public class Http2AsyncUpgradeHandler extends
Http2UpgradeHandler {
header[3] = FrameType.DATA.getIdByte();
if (finished) {
header[4] = FLAG_END_OF_STREAM;
- stream.sentEndOfStream();
- if (!stream.isActive()) {
-
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
- }
+ sentEndOfStream(stream);
}
if (writable) {
ByteUtil.set31Bits(header, 5, stream.getIdAsInt());
@@ -350,10 +347,7 @@ public class Http2AsyncUpgradeHandler extends
Http2UpgradeHandler {
header[3] = FrameType.DATA.getIdByte();
if (finished) {
header[4] = FLAG_END_OF_STREAM;
- sendfile.stream.sentEndOfStream();
- if (!sendfile.stream.isActive()) {
-
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
- }
+ sentEndOfStream(sendfile.stream);
}
if (writable) {
if (log.isDebugEnabled()) {
@@ -434,10 +428,7 @@ public class Http2AsyncUpgradeHandler extends
Http2UpgradeHandler {
header[3] = FrameType.DATA.getIdByte();
if (finished) {
header[4] = FLAG_END_OF_STREAM;
- sendfile.stream.sentEndOfStream();
- if (!sendfile.stream.isActive()) {
-
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
- }
+ sentEndOfStream(sendfile.stream);
}
if (writable) {
if (log.isDebugEnabled()) {
diff --git a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
index 2f8dc4e060..778eff3409 100644
--- a/java/org/apache/coyote/http2/Http2UpgradeHandler.java
+++ b/java/org/apache/coyote/http2/Http2UpgradeHandler.java
@@ -708,7 +708,7 @@ class Http2UpgradeHandler extends AbstractStream implements
InternalHttpUpgradeH
}
stream.sentHeaders();
if (endOfStream) {
- stream.sentEndOfStream();
+ sentEndOfStream(stream);
}
}
@@ -813,10 +813,7 @@ class Http2UpgradeHandler extends AbstractStream
implements InternalHttpUpgradeH
header[3] = FrameType.DATA.getIdByte();
if (finished) {
header[4] = FLAG_END_OF_STREAM;
- stream.sentEndOfStream();
- if (!stream.isActive()) {
-
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
- }
+ sentEndOfStream(stream);
}
if (writable) {
ByteUtil.set31Bits(header, 5, stream.getIdAsInt());
@@ -837,6 +834,14 @@ class Http2UpgradeHandler extends AbstractStream
implements InternalHttpUpgradeH
}
+ protected void sentEndOfStream(Stream stream) {
+ stream.sentEndOfStream();
+ if (!stream.isActive()) {
+
setConnectionTimeoutForStreamCount(activeRemoteStreamCount.decrementAndGet());
+ }
+ }
+
+
/*
* Handles an I/O error on the socket underlying the HTTP/2 connection
when it is triggered by application code
* (usually reading the request or writing the response). Such I/O errors
are fatal so the connection is closed. The
diff --git a/webapps/docs/changelog.xml b/webapps/docs/changelog.xml
index 4777094808..f77b97fd78 100644
--- a/webapps/docs/changelog.xml
+++ b/webapps/docs/changelog.xml
@@ -160,6 +160,13 @@
<bug>66512</bug>: Align AJP handling of invalid HTTP response headers
(they are now removed from the response) with HTTP. (markt)
</fix>
+ <fix>
+ <bug>66530</bug>: Correct a regression in the fix for bug
+ <bug>66442</bug> that meant that streams without a response body did
not
+ decrement the active stream count when completing leading to
+ <code>ERR_HTTP2_SERVER_REFUSED_STREAM</code> for some connections.
+ (markt)
+ </fix>
</changelog>
</subsection>
<subsection name="WebSocket">
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]