Bug 53843 - isAsyncStarted may return false in thread that started async processing
isAsyncStarted may return false in thread that started async processing
Status: RESOLVED FIXED
Product: Tomcat 7
Classification: Unclassified
Component: Catalina
7.0.30
PC Linux
: P2 normal (vote)
: ---
Assigned To: Tomcat Developers Mailing List
:
Depends on:
Blocks:
  Show dependency tree
 
Reported: 2012-09-08 00:42 UTC by Rossen Stoyanchev
Modified: 2012-09-20 09:57 UTC (History)
0 users



Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Rossen Stoyanchev 2012-09-08 00:42:57 UTC
After async processing starts in some container thread A, subsequent calls to request.isAsyncStarted() return true as expected.

However as soon as an application thread B calls asyncContext.dispatch(), isAsyncStarted() begins to return false even if the actual dispatch has not yet occurred. For this case the spec says: "the dispatch operation will be delayed until after the container-initiated dispatch has returned to the container."

For the brief period after dispatch() is called but before the actual dispatch begins (and DispatcherType becomes ASYNC), isAsyncStarted should return true. Without that, the return value of isAsyncStarted() may suddenly change while thread A is still exiting causing it to not recognize that async processing started and that it needs to exit as quickly as possible.
Comment 1 Mark Thomas 2012-09-08 15:13:49 UTC
Thanks for the report. The same holds for complete() as well as dispatch(). This has been fixed in trunk and 7.0.x and will be included in 7.0.31 onwards.
Comment 2 Mark Thomas 2012-09-20 09:57:23 UTC
Actually, complete() is different (the TCK fails if we treat it the same way). As soon as complete() is called , isAsyncStarted() must return false.