On Thu, Aug 1, 2013 at 11:32 AM, Joakim Erdfelt <[email protected]> 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"
>    Constant also available via
> javax.servlet.RequestDispatcher.ERROR_EXCEPTION_TYPE<http://docs.oracle.com/javaee/7/api/javax/servlet/RequestDispatcher.html#ERROR_EXCEPTION_TYPE>
> (Throwable) "javax.servlet.error.exception"
>    Constant also available via
> javax.servlet.RequestDispatcher.ERROR_EXCEPTION<http://docs.oracle.com/javaee/7/api/javax/servlet/RequestDispatcher.html#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
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to