Skip to content

Upgrde to Tomcat 8.5.39 breaks customized error controller #16486

@crmky

Description

@crmky

We upgrade our applications from Spring Boot 1.5.19.RELEASE to 1.5.20.RELEASE, and found the customized error controller is broken in this release because of Tomcat upgrade.

Tomcat 8.5.39 introduces a regression, apache/tomcat@d30d3e3#diff-95185e588de3604778aaae00c0afdf10. Now org.apache.coyote.Response.setStatus method will check previous status code and don't overwrite if the previous status is larger than 399.

    public void setStatus(int status) {
        if (this.status > 399) {
            // Don't overwrite first recorded error status
            return;
        }
        this.status = status;
    }

This causes problem for Spring Boot. For example, DefaultHandlerExceptionResolver may set the status to 400 for MissingServletRequestParameterException. But in our customized error controller, if we set the status to something else, the new status will be silently ignored.

Metadata

Metadata

Assignees

No one assigned

    Labels

    for: external-projectFor an external project and not something we can fix

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions