Mantis Bugtracker
  

Viewing Issue Advanced Details Jump to Notes ] View Simple ] 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 Platform
Status closed   OS
Projection none   OS Version
ETA none Fixed in Version 4.0.41 Product Version 4.0.40
  Product Build
Summary 0005779: The behavior of AsyncListener.onTimeout doesn't conform to the Servlet 3.0 Spec.
Description Per servlet 3.0 spec. section 2.3.3.3, 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 com.caucho.network.listen.TcpSocketLink - java.lang.IllegalStateException: async dispatch is not valid outside of an async cycle. Current state: REQUEST
                         at com.caucho.network.listen.SocketLinkRequestState.toAsyncWake(SocketLinkRequestState.java:361)
                         at com.caucho.network.listen.TcpSocketLink.requestWakeComet(TcpSocketLink.java:717)
                         at com.caucho.network.listen.TcpAsyncController.wake(TcpAsyncController.java:114)
                         at com.caucho.server.http.AsyncContextImpl.dispatch(AsyncContextImpl.java:244)
                         at com.quizzy.tourstory.ping.ActiveClients$ClientAsyncListener.complete(ActiveClients.java:251)
                         at com.quizzy.tourstory.ping.ActiveClients$ClientAsyncListener.onTimeout(ActiveClients.java:232)
                         at com.caucho.server.http.AsyncListenerNode.onTimeout(AsyncListenerNode.java:71)
                         at com.caucho.server.http.AsyncContextImpl.onTimeout(AsyncContextImpl.java:333)
                         at com.caucho.network.listen.TcpAsyncController.timeout(TcpAsyncController.java:143)
                         at com.caucho.network.listen.TcpSocketLink.handleResumeTask(TcpSocketLink.java:1087)
                         at com.caucho.network.listen.CometResumeTask.doTask(CometResumeTask.java:47)
                         at com.caucho.network.listen.ConnectionTask.runThread(ConnectionTask.java:110)
                         at com.caucho.network.listen.ConnectionTask.run(ConnectionTask.java:93)
                         at com.caucho.network.listen.SocketLinkThreadLauncher.handleTasks(SocketLinkThreadLauncher.java:169)
                         at com.caucho.network.listen.TcpSocketResumeThread.run(TcpSocketResumeThread.java:62)
                         at com.caucho.env.thread2.ResinThread2.runTasks(ResinThread2.java:173)
                         at com.caucho.env.thread2.ResinThread2.run(ResinThread2.java:118)

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.
Steps To Reproduce
Additional Information Servlet 3.0 spec. section 2.3.3.3:

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
(0006463)
azuo_lee
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();
asysn.addListener(listener);
async.setTimeout(3000);
return;

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.)
 
(0006500)
ferg
09-10-14 13:59

server/1ldb
 

- 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