https://bz.apache.org/bugzilla/show_bug.cgi?id=57824

            Bug ID: 57824
           Summary: fireRequestDestroyEvent does not get called when error
                    page is not found
           Product: Tomcat 7
           Version: 7.0.59
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: normal
          Priority: P2
         Component: Catalina
          Assignee: dev@tomcat.apache.org
          Reporter: michal.sevce...@etnetera.cz

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:

https://github.com/markt-asf/tomcat/commit/5e195b2f06dba1be3f90b0a9d1f67604af905e47

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()) {
                context.fireRequestDestroyEvent(request);
            }

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

    <error-page>
        <location>...</location>
    </error-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.

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

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

Reply via email to