Bug 68227 - AsyncListener::onComplete is not called on network error if error listener calls dispatch
Summary: AsyncListener::onComplete is not called on network error if error listener ca...
Status: RESOLVED FIXED
Alias: None
Product: Tomcat 10
Classification: Unclassified
Component: Servlet (show other bugs)
Version: 10.1.16
Hardware: PC All
: P2 normal (vote)
Target Milestone: ------
Assignee: Tomcat Developers Mailing List
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2023-11-26 20:11 UTC by jedenholm
Modified: 2023-11-30 17:02 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description jedenholm 2023-11-26 20:11:56 UTC
In the event of a network error, AsyncListener::onComplete is not called if the preceding call to AsyncListener::onError results in a call to AsyncContext::dispatch.

This behaviour is observed starting with Tomcat 10.1.12 as well as 10.1.16 (latest as of this writing). This behaviour is not observed in 10.1.11.

I have created two reproducers here: https://gitlab.com/-/snippets/3625015

One reproducer uses Spring Boot, and closely mirrors our production code. The other reproducer uses plain tomcat-embed, and was used by myself to figure out if this was a bug in Tomcat or in Spring.

The call to AsyncContext::dispatch is key to triggering this behaviour, without that the call to AsyncListener::onComplete occurs as expected.
Comment 1 Mark Thomas 2023-11-30 17:02:20 UTC
Fixed in:
- 11.0.x for 11.0.0-M15 onwards
- 10.1.x for 10.1.17 onwards
-  9.0.x for  9.0.84 onwards
-  8.5.x for  8.5.97 onwards

Thanks for the test case. I adapted it into a test for the Tomcat test suite.