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>


--
Joakim Erdfelt <[email protected]>
webtide.com <http://www.webtide.com/>
Developer advice, services and support
from the Jetty & CometD experts
eclipse.org/jetty - cometd.org


On Thu, Aug 1, 2013 at 7:51 AM, Rossen Stoyanchev <[email protected]
> wrote:

> I was able to reproduce and debug the issue. I think there is a Jetty
> issue. If asyncContext.dispatch() is invoked quickly before the initial
> request processing thread has exited, the dispatch is held as it should be,
> but request.isAsyncStarted returns (incorrectly) false, so remaining code
> on the initial request processing thread doesn't realize the async
> processing has started.
>
> Not sure if it matters but in such cases I do see calls to
> Response.getOutputStream() from within Jetty. Here is a sample stack trace:
>
> Response.getOutputStream() line: 700
> ErrorPageErrorHandler(ErrorHandler).handle(String, Request,
> HttpServletRequest, HttpServletResponse) line: 69
> ErrorPageErrorHandler.handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 159
> Response.sendError(int, String) line: 387
> Response.sendError(int) line: 339
> ServletHandler.doHandle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 582
> ServletHandler(ScopedHandler).handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 138
> ConstraintSecurityHandler(SecurityHandler).handle(String, Request,
> HttpServletRequest, HttpServletResponse) line: 540
> SessionHandler.doHandle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 213
> WebAppContext(ContextHandler).doHandle(String, Request,
> HttpServletRequest, HttpServletResponse) line: 1094
> ServletHandler.doScope(String, Request, HttpServletRequest,
> HttpServletResponse) line: 432
> SessionHandler.doScope(String, Request, HttpServletRequest,
> HttpServletResponse) line: 175
> WebAppContext(ContextHandler).doScope(String, Request, HttpServletRequest,
> HttpServletResponse) line: 1028
> WebAppContext(ScopedHandler).handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 136
> ContextHandlerCollection.handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 258
> HandlerCollection.handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 109
> RewriteHandler(HandlerWrapper).handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 97
> RewriteHandler.handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 317
> Server(HandlerWrapper).handle(String, Request, HttpServletRequest,
> HttpServletResponse) line: 97
> Server.handle(HttpChannel<?>) line: 445
> HttpConnection$HttpChannelOverHttp(HttpChannel<T>).handle() line: 267
> HttpConnection.onFillable() line: 224
> AbstractConnection$ReadCallback.run() line: 358
> QueuedThreadPool.runJob(Runnable) line: 601
> QueuedThreadPool$3.run() line: 532
> Thread.run() line: 722
>
> After all that the dispatch is executed still and calls to
> servletResponse.getWriter() fail with the originally reported
> "IllegalStateException: STREAM".
>
> Rossen
>
>
>
> _______________________________________________
> jetty-users mailing list
> [email protected]
> https://dev.eclipse.org/mailman/listinfo/jetty-users
>
>
_______________________________________________
jetty-users mailing list
[email protected]
https://dev.eclipse.org/mailman/listinfo/jetty-users

Reply via email to