Uploaded image for project: 'Undertow'
  1. Undertow
  2. UNDERTOW-2446

HttpServletRequestImpl.getParts may throw exception after already loading parts

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Done
    • Icon: Major Major
    • 2.3.18.Final, 2.2.37.Final
    • 2.5.0.Beta1, 2.3.19.Final
    • Servlet
    • None

      HttpServletRequestImpl.getParts still checks for the servlet multipart config after parts are already loaded. So if a multipart servlet serves the request and loads the parts successfully and then forwards the request to another non-multipart servlet (like a jsp), some end of request getParts clean up calls can then throw an exception:

      19:00:54,776 WARN  [org.springframework.web.multipart.support.StandardServletMultipartResolver] (default task-1) Failed to perform cleanup of multipart items: java.lang.IllegalStateException: UT010057: multipart config was not present on Servlet
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.spec.HttpServletRequestImpl.verifyMultipartServlet(HttpServletRequestImpl.java:567)
      	at io.undertow.servlet@2.3.10.SP3-redhat-00001//io.undertow.servlet.spec.HttpServletRequestImpl.getParts(HttpServletRequestImpl.java:556)
      	at jakarta.servlet.api@6.0.0.redhat-00001//jakarta.servlet.http.HttpServletRequestWrapper.getParts(HttpServletRequestWrapper.java:306)
      	at deployment.spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT.war//org.springframework.web.multipart.support.StandardServletMultipartResolver.cleanupMultipart(StandardServletMultipartResolver.java:122)
      	at deployment.spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT.war//org.springframework.web.servlet.DispatcherServlet.cleanupMultipart(DispatcherServlet.java:1268)
      	at deployment.spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT.war//org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:1125)
      	at deployment.spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT.war//org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:979)
      	at deployment.spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT.war//org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:1014)
      	at deployment.spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT.war//org.springframework.web.servlet.FrameworkServlet.doPost(FrameworkServlet.java:914)
      	at jakarta.servlet.api@6.0.0.redhat-00001//jakarta.servlet.http.HttpServlet.service(HttpServlet.java:547)
      

      In this case, undertow is eagerly checking and throwing the exception for the servlet multipart config (or lack thereof) that it was forwarded to even though we may have already loaded parts by the original servlet, which we can reuse and return.

              flaviarnn Flavia Rainone
              rhn-support-aogburn Aaron Ogburn
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

                Created:
                Updated:
                Resolved: