Mantis Bugtracker

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005779 [Resin] block always 07-23-14 02:47 09-10-14 13:59
Reporter azuo_lee View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.40
Summary 0005779: The behavior of AsyncListener.onTimeout doesn't conform to the Servlet 3.0 Spec.
Description Per servlet 3.0 spec. section, it should be legal to invoke AsyncContext.dispatch() within a AsyncListener.onTimeout() handler, but currently the resin server complains:

14-07-23 17:08:29.402 [resin-port-8080-22] WARNING - java.lang.IllegalStateException: async dispatch is not valid outside of an async cycle. Current state: REQUEST
                         at com.caucho.server.http.AsyncContextImpl.dispatch(
                         at com.caucho.server.http.AsyncListenerNode.onTimeout(
                         at com.caucho.server.http.AsyncContextImpl.onTimeout(
                         at com.caucho.env.thread2.ResinThread2.runTasks(

Further more, if neither AsyncContext.complete() nor AsyncContext.dispatch() is invoked within any AsyncListener.onTimeout() handler, the container should send back a 500 error to the client, but currenlty the resin server simply drops the connection?

Above rules should also be applied to AsyncLisener.onError() handler.
Additional Information Servlet 3.0 spec. section

In the event that an asynchronous operation times out, the container must run
through the following steps:
* Invoke the AsyncListener.onTimeout method on all the AsyncListener
instances registered with the ServletRequest on which the asynchronous
operation was initiated.
* If none of the listeners called AsyncContext.complete() or any of the
AsyncContext.dispatch methods, perform an error dispatch with a status
code equal to HttpServletResponse.SC_INTERNAL_SERVER_ERROR.
* If no matching error page was found, or the error page did not call
AsyncContext.complete() or any of the AsyncContext.dispatch
methods, the container MUST call AsyncContext.complete().
Attached Files

- Relationships

- Notes
07-23-14 02:59

Something even worse:

It seems that resin server ignores what is set by AsyncContext.setTimeout(), and triggers the timeout event at any time it likes?

For example, if i write following within an asynchronous servlet's service():
async = request.startAsync();

Then listener.onTimeout() may be invoked after 5 seconds, 10 seconds, 30 seconds... who knows exactly how many seconds! (of course, the final invocation to async.dispatch() within listener.onTimeout() throws the above exception, no matter how long we have waited.)
09-10-14 13:59


- Issue History
Date Modified Username Field Change
07-23-14 02:47 azuo_lee New Issue
07-23-14 02:59 azuo_lee Note Added: 0006463
09-10-14 13:59 ferg Note Added: 0006500
09-10-14 13:59 ferg Assigned To  => ferg
09-10-14 13:59 ferg Status new => closed
09-10-14 13:59 ferg Resolution open => fixed
09-10-14 13:59 ferg Fixed in Version  => 4.0.41

Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
31 total queries executed.
27 unique queries executed.
Powered by Mantis Bugtracker