Bug 69068 - ReadListener#onError not called on read exception during async processing
Summary: ReadListener#onError not called on read exception during async processing
Alias: None
Product: Tomcat 9
Classification: Unclassified
Component: Servlet (show other bugs)
Version: unspecified
Hardware: Macintosh Mac OS X 10.1
: P2 normal (vote)
Target Milestone: -----
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2024-05-29 12:43 UTC by hypnoce
Modified: 2024-06-03 07:20 UTC (History)
0 users

Unit test (3.92 KB, text/x-csrc)
2024-05-29 12:43 UTC, hypnoce

Note You need to log in before you can comment on or make changes to this bug.
Description hypnoce 2024-05-29 12:43:30 UTC
Created attachment 39749 [details]
Unit test

During an HTTP/2 async request, when the client closes the connection before the server could fully read the request, no exception is reported to the ReadListener attached to the ServletInputStream.

Here are the steps:
* Start tomcat with HTTP/2 enabled and an async servlet
* Start an HTTP/2 request by sending only the headers
* The servlet receives the request and attaches a read listener
* The client closes the connection before sending the body and trailers
* The read listener is expected to be called to notify a read issue

You will find attached a Unit Test file to reproduce the problem.

Let me know if this is an expected behaviour or an actual bug.

Comment 1 Mark Thomas 2024-05-31 17:26:54 UTC
First of all, thank you very much indeed for the test case. It is extremely rare for a bug report to come with a test case that we can just drop in the IDE and (part from some tweaks so it runs in 11.0.x rather than 9.0.x) it just works. It saves us so much time and really is appreciated.

This is a bug. You should see a SocketTimeoutException in the ReadListener as you would if the request was made over HTTP/1.1

I have a fix for this locally. I just need to clean it up and complete some testing.
Comment 2 Mark Thomas 2024-06-02 14:27:07 UTC
All good.

Fixed in:
- 11.0.x for 11.0.0-M21 onwards
- 10.1.x for 10.1.25 onwards
-  9.0.x for  9.0.90 onwards
Comment 3 hypnoce 2024-06-03 07:20:36 UTC
Thanks a lot ! That really helps. Will test it when new release is available and get back to you.