Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0005420 [Resin] major always 04-15-13 18:09 05-01-13 10:35
Reporter bhauer1 View Status public  
Assigned To ferg
Priority normal Resolution fixed  
Status closed   Product Version 4.0.35
Summary 0005420: AsyncContext completed by original synchronous worker thread?
Description It is possible I am doing something wrong, but in Resin 4.0.35, AsyncContexts are being completed immediately when the synchronous worker thread handling a request returns to Resin (after Servlet.service() is done).

In other words, it is impossible to work with an AsyncContext once the Servlet's service() method returns, which seems to work against the purpose of AsyncContext.
Additional Information I am attaching a simple example Servlet that responds immediately and synchronously to /test and responds asynchronously after a 2 second delay to /test?type=async.

The asynchronous version calls request.startAsync, attaches an AsyncListener, and submits a Runnable to a ScheduledExecutorService to run after 2 seconds.

The AsyncListener will show a call to onComplete() immediately (at the conclusion of the service() method). By the time the ScheduledExecutorService runs the Runnable, the AsyncContext has been closed and the Runnable freezes up.

If you print a Throwable in the listener's onComplete method, the following stack trace is visible:

at com.caucho.server.http.AsyncListenerNode.onComplete(AsyncListenerNode.java:83)
at com.caucho.server.http.AsyncContextImpl.onComplete(AsyncContextImpl.java:379)
at com.caucho.server.http.HttpServletRequestImpl.finishRequest(HttpServletRequestImpl.java:1696)
at com.caucho.server.http.AbstractHttpRequest.finishRequest(AbstractHttpRequest.java:1848)
at com.caucho.server.hmux.HmuxRequest.handleRequestImpl(HmuxRequest.java:385)
...

Shouldn't the request remain alive until the AsyncContext.complete() method is called?
Attached Files  AsyncTest.java [^] (2,733 bytes) 04-15-13 18:09

- Relationships
related to 0005268closed ferg NPE using Asynch Servlet over Hmux 

- Notes
(0006267)
ferg
05-01-13 10:35

server/1ld7

Note: this issue is specific to Hmux, i.e. Resin behind a load balancer.
 

- Issue History
Date Modified Username Field Change
04-15-13 18:09 bhauer1 New Issue
04-15-13 18:09 bhauer1 File Added: AsyncTest.java
04-22-13 08:28 cowan Relationship added related to 0005268
05-01-13 10:35 ferg Note Added: 0006267
05-01-13 10:35 ferg Assigned To  => ferg
05-01-13 10:35 ferg Status new => closed
05-01-13 10:35 ferg Resolution open => fixed
05-01-13 10:35 ferg Fixed in Version  => 4.0.37


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