Bug 57824 - fireRequestDestroyEvent does not get called when error page is not found
Summary: fireRequestDestroyEvent does not get called when error page is not found
Alias: None
Product: Tomcat 7
Classification: Unclassified
Component: Catalina (show other bugs)
Version: 7.0.59
Hardware: PC Windows NT
: P2 normal (vote)
Target Milestone: ---
Assignee: Tomcat Developers Mailing List
Depends on:
Reported: 2015-04-16 17:14 UTC by Michal Ševčenko
Modified: 2015-04-16 18:59 UTC (History)
0 users


Note You need to log in before you can comment on or make changes to this bug.
Description Michal Ševčenko 2015-04-16 17:14:42 UTC
When upgrading tomcat to 7.0.59 we started experience strange errors in WELD integration layer. It seems that when an error occurres (e.g. 403 reported by HttpServletResponse.sendError(HttpServletResponse.SC_FORBIDDEN)), which does not have error page handler declared in web.xml, the org.apache.catalina.Context.fireRequestDestroyEvent does not get called.

The problem may be related to the following change:


which was a fix of BUG#57252.

The problem may be in StandardHostValve

lines 319:324
        ErrorPage errorPage = context.findErrorPage(statusCode);
        if (errorPage == null) {
            // Look for a default error page
            errorPage = context.findErrorPage(0);
        if (errorPage != null && response.setErrorReported()) {

i.e. if error page is not found the reposnse is not marked as "setErrorReported"

and then lines 214-216

            if (!request.isAsync() && !response.isErrorReportRequired()) {

i.e. if request is synchronous and the error report is not required (caused by missing error page) the important lifecycle method is not called.

The workaround is to declare universal error handler page


which ensures that some error page is always found.

The problem may also be related to BUG#57314 as it has the same symptoms reported in

http://weld.cdi-spec.org/documentation/ see What do WELD-xxx warnings mean?

ie WELD-000225, WELD-000335, WELD-000715 errors that report leaked resources caused by missing lifecycle method call.

According to this bug report we thought that the problem is caused by async requests (which we do not use explicitly), but declaring the error page correctly seems to fix the problem.
Comment 1 Violeta Georgieva 2015-04-16 18:59:52 UTC

Fix is provided in Tomcat 7 trunk and will be available for 7.0.62 onwards.