Issue Details (XML | Word | Printable)

Key: GLASSFISH-19364
Type: Bug Bug
Status: Resolved Resolved
Resolution: Fixed
Priority: Major Major
Assignee: Shing Wai Chan
Reporter: winston_jack
Votes: 0
Watchers: 1
Operations

If you were logged in you would be able to see more operations.
glassfish

web container does not call AsyncContext.complete() if dispatched servlet throws Exception

Created: 22/Nov/12 01:39 PM   Updated: 22/Dec/12 10:00 AM   Resolved: 27/Nov/12 10:15 PM
Component/s: web_container
Affects Version/s: 3.1.2.2
Fix Version/s: 4.0_b65

Time Tracking:
Not Specified

File Attachments: 1. File asynctest.war (7 kB) 22/Nov/12 01:39 PM - winston_jack


Tags:
Participants: Shing Wai Chan and winston_jack


 Description  « Hide

When an exception occurs in the execution of async dispatch(),
web container MUST call AsyncContext.complete()
if user application(AsyncListener or Error Page) does not call AsyncContext.complete().

This behavior is written in the explanation of AsyncContext in Servlet 3.0 specification, section 2.3.3.3 Asynchronous processing.

Any errors or exceptions that may occur during the execution of the dispatch methods MUST be caught and handled by the container as follows:

i.invoke the AsyncListener.onError(AsyncEvent) method for all instances of the AsyncListener registered with the ServletRequest for which the AsyncContext was created and make the caught Throwable available via the AsyncEvent.getThrowable()
ii. If none of the listeners called AsyncContext.complete or any of the AsyncContext.dispatch methods, then perform an error dispatch with a status code equal to HttpServletResponse.SC_INTERNAL_SERVER_ERROR and make the Throwable available as the value of the RequestDispatcher.ERROR_EXCEPTION request attribute.
iii.If no matching error page is found, or the error page does not call AsyncContext.complete() or any of the AsyncContext.dispatch methods, then the container MUST call AsyncContext.complete.

However, glassfish seems not to call AsyncContext.complete() if AsyncLister.onError() or Error Page does not call AsyncContext.complete().
Therefore, my sample application always waits until async timeout(glassfish default 30 seconds).

In addition, glassfish does not call complete() in case of async timeout of dispatch().
But if I use start() method for async processing, complete() is called in case of async timeout.

Is this a bug?
Otherwise, is my understanding of the specification wrong?