tomcathttp2tomcat9tls1.3

Tomcat over HTTP2


I am implementing an client application to work in TLS1.3 and HTTP2 protocols. Its working fine if the receive window size is greater than the response. I have set the receive window size to 65536. If the window size is less than the response size and if I update the window size using WINDOW_UPDATE frame, it is not being reflected in Tomcat, but recorded in logs, thereby causing Timeout error :

org.apache.coyote.CloseNowException: org.apache.coyote.http2.StreamException: Timeout waiting for client to increase flow control window to permit stream data to be written

I have configured Tomcat with SSL Certificates to work under HTTPS over TLS1.3 and HTTP2 Protocols.

<Connector port="443" protocol="org.apache.coyote.http11.Http11AprProtocol"
               maxThreads="150" SSLEnabled="true" useIPVHosts="true" resolveHosts="true" address="0.0.0.0">
        <UpgradeProtocol className="org.apache.coyote.http2.Http2Protocol"/>
        <SSLHostConfig>
            <Certificate certificateKeyFile="C:/Users/Testenv/Desktop/Certs/server.key"
                         certificateFile="C:/Users/Testenv/Desktop/Certs/server.crt"
                         type="RSA" />
        </SSLHostConfig>
</Connector>

I have sent WINDOW_UPDATE frame, and the WINDOW_UPDATE has been processed by Tomcat and reflected in Logs of Tomcat. But still the timeout exception is thrown.

09-Jun-2023 15:56:42.916 FINE [https-openssl-apr-0.0.0.0-443-exec-3] org.apache.coyote.http2.WindowAllocationManager.waitForStream Connection [0], Stream [1], Waiting for Stream flow control window (blocking) with timeout [20000]
09-Jun-2023 15:56:43.007 FINE [https-openssl-apr-0.0.0.0-443-exec-4] org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch Entry, Connection [0], SocketStatus [OPEN_READ]
09-Jun-2023 15:56:43.013 FINE [https-openssl-apr-0.0.0.0-443-exec-4] org.apache.coyote.http2.Http2UpgradeHandler.init Connection [0], State [CONNECTED]
09-Jun-2023 15:56:43.013 FINE [https-openssl-apr-0.0.0.0-443-exec-4] org.apache.coyote.http2.Http2Parser.validateFrame Connection [0], Stream [0], Frame type [WINDOW_UPDATE], Flags [0], Payload size [4]
09-Jun-2023 15:56:43.013 FINE [https-openssl-apr-0.0.0.0-443-exec-4] org.apache.coyote.http2.Http2Parser.readWindowUpdateFrame Connection [0], Stream [0], Window size increment [32768]
09-Jun-2023 15:56:43.013 FINE [https-openssl-apr-0.0.0.0-443-exec-4] org.apache.coyote.http2.AbstractStream.incrementWindowSize Connection [0], Stream [0], increase flow control window by [32768] to [32768]
09-Jun-2023 15:56:43.013 FINE [https-openssl-apr-0.0.0.0-443-exec-4] org.apache.coyote.http2.Http2UpgradeHandler.upgradeDispatch Exit, Connection [0], SocketState [UPGRADED]
09-Jun-2023 15:57:09.119 FINE [https-openssl-apr-0.0.0.0-443-exec-3] org.apache.coyote.AbstractProcessor.setErrorState Error state [CLOSE_NOW] reported while processing request
        org.apache.coyote.CloseNowException: org.apache.coyote.http2.StreamException: Timeout waiting for client to increase flow control window to permit stream data to be written

Logs Tomcat-Logs.txt

Pcap Trace Tomcat-Trace.pcapng

Pcap Trace - Key Key.log

What's the cause of the problem and how to fix it?


Solution

  • I think its a bug in Apache Tomcat/9.0.70. I just upgraded the Tomcat and the issue gets fixed.