codeconsole opened a new pull request, #1264: URL: https://github.com/apache/tomcat/pull/1264
Fixes https://bz.apache.org/bugzilla/show_bug.cgi?id=70362 Since the fix for BZ 66875, `CoyoteAdapter.asyncDispatch` starts async error handling whenever the response is in an error state once an async dispatch returns. When that dispatch called `sendError()` and returned normally without starting async processing again, `AsyncContextImpl.doInternalDispatch` has already fired `onComplete`. The listeners are then told of an error with a null throwable and of completion a second time: `[onComplete, onError(null), onComplete]`. 10.1.15 and earlier delivered `[onComplete]`. `doInternalDispatch` now records that it completed the async processing, and `asyncDispatch` skips the error handling in that case. A dispatch that throws is unchanged: `doInternalDispatch` does not fire `onComplete` then, so the error still reaches the listeners and the error page. The flag is reset when async processing starts again and when the context is recycled. Tests: - `TestAsyncContextImpl.testSendErrorOnAsyncDispatchCompletesOnce` fails on `main` without the change, with `onComplete-onError-onComplete-`, and passes with it. - With the change, these all pass on NIO, 663 tests in 28 classes: - `TestAsync*`, `TestAsyncContextImpl*` and `TestAsyncStateMachine`; - every `catalina.connector` test, including `TestCoyoteAdapterAsyncErrorState`; - `TestStandardHostValve`, `TestStandardWrapper`, `TestErrorReportValve`, `TestNonBlockingAPI` and `TestHttp11Processor`. - `testTimeoutDispatchCustomErrorPage`, a `sendError(503)` in an async dispatch with a custom error page, still renders that page. It should be back-ported to 11.0.x, 10.1.x and 9.0.x, which carry the 66875 change. -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
