Bug 66530 - ERR_HTTP2_SERVER_REFUSED_STREAM since 9.0.72
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Connectors (show other bugs)
Version: 9.0.72
Hardware: PC All
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2023-03-16 11:22 UTC by Javier Santiago
Modified: 2023-03-17 09:40 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Javier Santiago 2023-03-16 11:22:16 UTC
Hi team,

Since Tomcat 9.0.72 (also tested in 9.0.73) seems there is an issue related to HTTP2 Protocol. We are using default values for HTTP2 protocol

<UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"/>

But since 9.0.72 version we receive randomly ERR_HTTP2_SERVER_REFUSED_STREAM error messages for random static files (images, js, etc...)

org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch Connection [0], Stream [473] Closed due to error
 Note: further occurrences of HTTP/2 stream errors will be logged at DEBUG level.
	org.apache.coyote.http2.StreamException: The client attempted to use more than [100] active streams
		at org.apache.coyote.http2.Http2UpgradeHandler.headersEnd(Http2UpgradeHandler.java:1723)
		at org.apache.coyote.http2.Http2Parser.onHeadersComplete(Http2Parser.java:622)
		at org.apache.coyote.http2.Http2Parser.readHeadersFrame(Http2Parser.java:284)
		at org.apache.coyote.http2.Http2Parser.readFrame(Http2Parser.java:110)
		at org.apache.coyote.http2.Http2Parser.readFrame(Http2Parser.java:82)
		at org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch(Http2UpgradeHandler.java:345)
		at org.apache.coyote.http11.upgrade.UpgradeProcessorInternal.dispatch(UpgradeProcessorInternal.java:60)
		at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:57)
		at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:926)
		at org.apache.tomcat.util.net.AprEndpoint$SocketProcessor.doRun(AprEndpoint.java:2156)
		at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
		at org.apache.tomcat.util.threads.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1191)
		at org.apache.tomcat.util.threads.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:659)
		at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
		at java.base/java.lang.Thread.run(Thread.java:829)

Error is quite clear. Basically we are using more streams that available. But the problem is that we are not loading 100 files in the requests, but 20 or 30. Based in docs we have increased the maxConcurrentStreams up to 400 with the same result. So seems that streams are not being closed correctly.

As told, this issue only appeared in 9.0.72 and 9.0.73, but on on 9.0.71 and below, so seems some issue caused by some change in version 9.0.72

It would be great if you wan take a look.

Thank you!
Comment 1 Mark Thomas 2023-03-16 17:49:01 UTC
Fortunately there are only nine changes to the HTTP/2 code between 9.0.71 and 9.0.72. Seven of those changes are non-functional changes which leaves two.

It is the fix for bug 66442 that is causing the issue. Responses without a body are not decrementing the active stream count when complete. I'm investigating a fix now.
Comment 2 Mark Thomas 2023-03-17 09:25:09 UTC
Fixed in:
- 11.0.x for 11.0.0-M5 onwards
- 10.1.x for 10.1.8 onwards
-  9.0.x for  9.0.74 onwards
-  8.5.x for  8.5.88 onwards
Comment 3 Javier Santiago 2023-03-17 09:40:44 UTC
Thank you very much Mark