Uploaded image for project: 'XWiki Platform'
  1. XWiki Platform
  2. XWIKI-23275

Importing a XAR containing a lot of documents fails in Tomcat 11 with default settings

    XMLWordPrintable

Details

    • Bug
    • Resolution: Unresolved
    • Critical
    • None
    • 17.4.0
    • Windows 11 Pro, Edge 137, using an instance of XWiki 17.4.0 on MariaDB 11.7, Tomcat 11.0.7
    • Unknown

    Description

      Steps to reproduce

      The manual test where this was reproduced is: Backup and restore a Wiki

      1. Start an XWiki instance on Tomcat 11 (I tested on 11.0.7 with XWiki 17.4.0)
      2. Have a XAR package containing more than 1000 documents (e.g. from exporting all pages from a subwiki there should be app. 1500 documents or more)
      3. Import the package (e.g. into an empty created subwiki)

      Expected results

      The import is successful without any errors.

      Actual results

      The following error is displayed in browser:

      Failed to import documents. Reason: Server not responding

      In the request's response body, there is the following stacktrace:

      <!doctype html>
      <html lang="en">
          <head>
              <title>HTTP Status 400 – Bad Request</title>
              <style type="text/css">
                  body {
                      font-family: Tahoma,Arial,sans-serif;
                  }
      
                  h1, h2, h3, b {
                      color: white;
                      background-color: #525D76;
                  }
      
                  h1 {
                      font-size: 22px;
                  }
      
                  h2 {
                      font-size: 16px;
                  }
      
                  h3 {
                      font-size: 14px;
                  }
      
                  p {
                      font-size: 12px;
                  }
      
                  a {
                      color: black;
                  }
      
                  .line {
                      height: 1px;
                      background-color: #525D76;
                      border: none;
                  }
              </style>
          </head>
          <body>
              <h1>HTTP Status 400 – Bad Request</h1>
              <hr class="line"/>
              <p>
                  <b>Type</b>
                  Exception Report
              </p>
              <p>
                  <b>Message</b>
                  More than the maximum number of request parameters (GET plus POST) for a single request ([1,000]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
              </p>
              <p>
                  <b>Description</b>
                  The server cannot or will not process the request due to something that is perceived to be a client error (e.g., malformed request syntax, invalid request message framing, or deceptive request routing).
              </p>
              <p>
                  <b>Exception</b>
              </p>
              <pre>org.apache.tomcat.util.http.InvalidParameterException: More than the maximum number of request parameters (GET plus POST) for a single request ([1,000]) were detected. Any parameters beyond this limit have been ignored. To change this limit, set the maxParameterCount attribute on the Connector.
      	org.apache.tomcat.util.http.Parameters.addParameter(Parameters.java:178)
      	org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:342)
      	org.apache.tomcat.util.http.Parameters.processParameters(Parameters.java:201)
      	org.apache.catalina.connector.Request.doParseParameters(Request.java:2864)
      	org.apache.catalina.connector.Request.parseParameters(Request.java:2763)
      	org.apache.catalina.connector.Request.getParameterNames(Request.java:1092)
      	org.apache.catalina.connector.Request.getParameterMap(Request.java:1077)
      	org.apache.catalina.connector.RequestFacade.getParameterMap(RequestFacade.java:173)
      	jakarta.servlet.ServletRequestWrapper.getParameterMap(ServletRequestWrapper.java:168)
      	org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter$SavedRequestWrapper.getParameterMap(SavedRequestRestorerFilter.java:167)
      	org.xwiki.wysiwyg.internal.filter.http.MutableJakartaHttpServletRequest.&lt;init &gt;(MutableJakartaHttpServletRequest.java:58)
      	org.xwiki.wysiwyg.internal.filter.http.MutableHttpServletRequestFactory.newInstance(MutableHttpServletRequestFactory.java:42)
      	org.xwiki.wysiwyg.internal.converter.AbstractRequestParameterConverter.convert(AbstractRequestParameterConverter.java:93)
      	org.xwiki.wysiwyg.internal.converter.AbstractRequestParameterConverter.convert(AbstractRequestParameterConverter.java:78)
      	org.xwiki.wysiwyg.filter.ConversionFilter.convert(ConversionFilter.java:84)
      	org.xwiki.wysiwyg.filter.ConversionFilter.doFilter(ConversionFilter.java:66)
      	org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
      	org.xwiki.container.servlet.filters.internal.SetHTTPHeaderFilter.doFilter(SetHTTPHeaderFilter.java:66)
      	org.xwiki.resource.servlet.RoutingFilter.doFilter(RoutingFilter.java:135)
      	org.xwiki.container.servlet.filters.internal.SavedRequestRestorerFilter.doFilter(SavedRequestRestorerFilter.java:211)
      	org.xwiki.container.servlet.filters.internal.SafeRedirectFilter.doFilter(SafeRedirectFilter.java:106)
      	org.xwiki.container.servlet.filters.internal.ResolveRelativeRedirectFilter.doFilter(ResolveRelativeRedirectFilter.java:129)
      	org.xwiki.container.servlet.filters.internal.SetCharacterEncodingFilter.doFilter(SetCharacterEncodingFilter.java:120)
      </pre>
              <p>
                  <b>Note</b>
                  The full stack trace of the root cause is available in the server logs.
              </p>
              <hr class="line"/>
              <h3>Apache Tomcat/11.0.7</h3>
          </body>
      </html>

      This was not reproducing while using Tomcat 9. It seems Tomcat 9 has a default maxParameterCount of 10000 and Tomcat 11 has a value of 1000, see https://tomcat.apache.org/tomcat-11.0-doc/config/http.html.

      After setting the maxParameterCount="10000" parameter in server.xml, the import works properly, but it should work without changing this configuration.

      The issue doesn't reproduce on XWiki 17.4.0 using Jetty/HSQL distribution.

      Attachments

        Issue Links

          Activity

            People

              Unassigned Unassigned
              iandriuta Ilie Andriuta
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated: