Bug 66842 - Http2AsyncUpgradeHandler does not update overhead count based on sent frames
Summary: Http2AsyncUpgradeHandler does not update overhead count based on sent frames
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Connectors (show other bugs)
Version: 9.0.76
Hardware: PC Linux
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-08-03 17:51 UTC by Andrew Murphy
Modified: 2023-08-06 11:50 UTC (History)
1 user (show)



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Andrew Murphy 2023-08-03 17:51:44 UTC
Encountered while testing configurations for https://bz.apache.org/bugzilla/show_bug.cgi?id=66841

<Connector port="8443" protocol="org.apache.coyote.http11.Http11Nio2Protocol"
               connectionTimeout="20000" maxThreads="150"
               SSLEnabled="true" scheme="https" secure="true" useAsyncIO="true" >
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol" />
        <SSLHostConfig>
			<Certificate certificateKeystoreFile="conf/certs/devkeystore"
						 type="RSA"/>
        </SSLHostConfig>
    </Connector>

Given an application using Spring server sent event emitters to send notifications to logged in users and the application sends heartbeat messages through those SSE emitters to test they are still active. If using a connector config similar to above (HTTP 2 upgrade and useAsyncIO true) then the data frames of the heartbeat message will not reduce the overhead count but the WINDOW_UPDATE frames received in acknowledgement will increase the overhead count. This causes the overhead count to be exceeded within just a few heartbeat cycles.

To reproduce:
1. Use NIO2 protocol with Http2Protocol upgrade and useAsyncIO true
2. deploy application with endpoint to create event stream that the application sends messages on continuously from separate thread
3. Access endpoint from browser (I used chrome but assume it occurs with other browsers)
4. wait

After each message sent on the event stream a WINDOW_UPDATE frame will be received which increases the overhead count. Without the data frames of the sent messages lowering the overhead count the connection will quickly be closed due to overhead count exceeded.
Comment 1 Mark Thomas 2023-08-06 11:50:05 UTC
Fixed in:
- 11.0.x for 11.0.0-M10 onwards
- 10.1.x for 10.1.12 onwards
-  9.0.x for  9.0.79 onwards

8.5.x was unaffected.