Skip to main content

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [List Home]
Re: [jetty-users] Jetty 9.0.4 issue (also in 9.0.5-SNAPSHOT) with Spring MVC Async (test provided)

On Thu, Aug 1, 2013 at 11:32 AM, Joakim Erdfelt <joakim@xxxxxxxxxxx> wrote:
So we tracked down where the Response.getOutputStream() is being used.
>From an ErrorHandler internal to Jetty.

The Jetty code caught an unhandled Throwable during the processing of servlets (and filters) in ServletHandler.doHandle(String, Request, HttpServletRequest, HttpServletResponse) and triggered the ErrorHandler response mechanism.
Then the code ALSO attempted to process the request as well, requesting the Response.getWriter() which triggered another exception: "IllegalStateException: STREAM"

Do you know what the original unhandled Throwable was?
You can check the HttpServletRequest.getAttribute() under the following keys:

(Class) "javax.servlet.error.exception_type"
(Throwable) "javax.servlet.error.exception"
   Constant also available via javax.servlet.RequestDispatcher.ERROR_EXCEPTION


I think the issue starts with request.isAsyncStarted returning false after async was started and a dispatch was issued immediately. Now rather than exiting the request processing thread, code continues to execute as if async did not start. That's going to lead to an exception. 

I can find out what that exception is, if you still want me to, but you should be able to easily reproduce what I think is the root cause by calling request.startAsync(req,res), then calling asyncContext.dispatch(), and then checking if async has started. It returns false instead of true.

Rossen 


 

Back to the top