Uploaded image for project: 'JBoss Enterprise Application Platform'
  1. JBoss Enterprise Application Platform
  2. JBEAP-28063

[GSS](8.0.z) UNDERTOW-2446 - HttpServletRequestImpl.getParts may throw exception after already loading parts

XMLWordPrintable

    • False
    • None
    • False
    • Workaround Exists
    • Hide

      Avoid forwarding a request after calling request.getParts or subsequent request.getParts calls after forwarding a request

      Show
      Avoid forwarding a request after calling request.getParts or subsequent request.getParts calls after forwarding a request
    • Hide

      1. Deploy the attached war
      2. Request http://localhost:8080/spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT/employee and upload an arbitrary small file
      3. Note the resulting exception

      Show
      1. Deploy the attached war 2. Request http://localhost:8080/spring-mvc-forms-thymeleaf-0.0.1-SNAPSHOT/employee and upload an arbitrary small file 3. Note the resulting exception

      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:
              2 Start watching this issue

                Created:
                Updated:
                Resolved: