Created attachment 32224 [details] Small app to reproduce the problem If an error is sent as part of some asynchronous processing, for example: @WebServlet(value = "/async", asyncSupported=true) public class AsyncServlet extends HttpServlet { protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException { final AsyncContext context = request.startAsync(); context.start(new Runnable() { @Override public void run() { try { response.sendError(500); } catch (IOException e) { } context.complete(); } }); } } Tomcat 7.0.57 renders its default error page rather than the configured custom error page. The same behaviour is also exhibited in recent 8.0.x releases. It's perhaps worth noting that Tomcat 7.0.55 renders an entirely blank page in this scenario. My expectation is that the custom error page is used and, FWIW, this is what Jetty does. I have attached a war that can be used to reproduce the problem. /sync can be used to confirm that the custom error page is working. /async will reproduce the problem described above.
FYI. I am currently working on this but my test cases have identified a further concurrency issue with the error handling that I am going to have to fix first.
Proposed fix: https://github.com/markt-asf/tomcat/commit/5e195b2f06dba1be3f90b0a9d1f67604af905e47 I'll commit this once the svn server returns to read/write
Test case created and fix applied to trunk, 8.0.x (for 8.0.16) and 7.0.x for (7.0.58).