Bug 62358 - Stream not writable error when using HTTP2 upgrade protocol on Firefox
Summary: Stream not writable error when using HTTP2 upgrade protocol on Firefox
Status: RESOLVED INVALID
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 9.0.8
Hardware: PC All
: P2 minor (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2018-05-07 23:37 UTC by EJ Egyed
Modified: 2018-05-08 11:35 UTC (History)
0 users



Attachments
Tomcat stderr log file (269.72 KB, text/plain)
2018-05-07 23:37 UTC, EJ Egyed
Details
Tomcat stderr log file with HTTP2 logging set to FINE (940.07 KB, text/plain)
2018-05-08 10:56 UTC, EJ Egyed
Details

Note You need to log in before you can comment on or make changes to this bug.
Description EJ Egyed 2018-05-07 23:37:03 UTC
Created attachment 35919 [details]
Tomcat stderr log file

Current Setup (if information is necessary):

Tomcat 9.0.8
ORDS (Oracle REST Data Services) Version 18.1.1.95.1251 (ords.war file downloadable from Oracle's website)
Firefox 59.0.3
JDK and JRE version 1.8.0_161

There are some pages in our application that when the page is accessed from Firefox (only Firefox.  Not a problem in any other browser), the page freezes.  Looking at the browser debugger, a request was sent, but no response was received.  When this situation happens, an error is logged in Tomcat's stderr log file.

Looking at the stack that is printed in the error in the log file, one of the lines is:
org.apache.coyote.http2.Http2UpgradeHandler.reserveWindowSize(Http2UpgradeHandler.java:733)

Our current setup in server.xml is utilizing the HTTP2 upgrade protocol.  Thinking that was related to the error, we removed that so that Tomcat was using the HTTP 1.1 protocol again.  After going back to 1.1, the problem no longer occurs.

Attached is the log file with the generated errors.  Please let me know if there is anything more information I can provide to help troubleshoot the issue.
Comment 1 Mark Thomas 2018-05-08 10:40:32 UTC
It isn't clear if this is a Tomcat bug or soemthing else.

Please do the following:
- stop Tomcat
- remove existing log files
- Add "org.apache.coyote.http2.level = FINE" at the end of logging.properties
- start Tomcat
- do the minimum necessary to re-create the error
- attach the log file with the HTTP/2 debug messages
Comment 2 EJ Egyed 2018-05-08 10:56:52 UTC
Created attachment 35920 [details]
Tomcat stderr log file with HTTP2 logging set to FINE

Attaching log with the requested information
Comment 3 Mark Thomas 2018-05-08 11:27:23 UTC
Thanks for the debug log. It appears that this is not a Tomcat bug.

The first error occurs on Connection [0], Stream [217]

Following that connection in the debug log shows:
08-May-2018 06:54:13.779
- Client sends HEADERS frame and stream 217 is created
- flags=36 (includes Priority, end headers)

The end stream flag is not set so there should be a request body.

08-May-2018 06:54:13.779
- Stream transitions to IDLE
- Headers are read
- Window size updated (plenty of space before and after)

08-May-2018 06:54:13.779
- DATA frame sent (request body)
- flags=1 (end stream)

The data is read and the stream transitions to HALF_CLOSED_REMOTE because no more data is expected from the client.

08-May-2018 06:54:13.842
- client sends RESET frame with reason 8 (CANCEL).
- Tomcat closes the stream which blocks further I/O

08-May-2018 06:54:14.701
- application tries to write to response
- I/O fails because the stream has been closed

The client is resetting the stream (CANCEL). The expectation is that the application catches the ClientAbortException and handles it which usually means ignore it since they can be fairly frequent.
Comment 4 EJ Egyed 2018-05-08 11:35:35 UTC
Interesting.  Perhaps it is Firefox's issue with mishandling of the HTTP2 protocol.  Thank you for the assistance!