You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@tomcat.apache.org by bu...@apache.org on 2014/08/06 15:25:16 UTC

[Bug 56739] Error response body generated only occasionally

https://issues.apache.org/bugzilla/show_bug.cgi?id=56739

--- Comment #1 from Mark Thomas <ma...@apache.org> ---
The good news is that I now know what is going on here.

When the request is received it is process on container Thread C. By the time
the thread reaches the Servlet, it has passed through Tomcat's request
processing pipeline including the ErrorReportValve. If the Servlet's doGet()
method, an application thread A is created just before the end of doGet().
Thread C then starts to exit Tomcat's request processing pipeline.

Thread A calls sendError() and complete().

If thread C exits the ErrorReportValve before thread A calls sendError() then
no response body will be generated.

If thread A calls sendError() before thread C exits the ErrorReportValve then a
response body will be generated.

In short, this comes down to a timing issue between the container and the
application thread and the way that Tomcat reports unhandled errors with the
ErrorReportValve. It would also be the case the a custom error page (handled by
the StandardHostValve) is unlikely to be called in this case.

The bad news is that I don't see an obvious fix. It looks like the error page
handling is going to need some refactoring but doing that without breaking the
existing API (particularly for the ErrorReportVlave) is going to be tricky.

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscribe@tomcat.apache.org
For additional commands, e-mail: dev-help@tomcat.apache.org