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

"Unable to parse form content" error when trying to upload a large attachment with Jetty

Details

    • Unknown
    • N/A
    • N/A

    Description

      Environment: XWiki 16.0.0 Jetty HSQLDB on Fedora 39

      When trying to upload a large file to any page an error occurs

      and the following logs appear:

      2024-02-23 15:55:07.258:WARN :oejs.Request:qtp798244209-72 - http://localhost:8080/xwiki/bin/upload/Main/WebHome: java.lang.IllegalStateException: java.lang.OutOfMemoryError: Required array length 2147483639 + 15246 is too large
      2024-02-23 15:55:07.261:WARN :oejs.HttpChannel:qtp798244209-72: handleException /xwiki/bin/upload/Main/WebHome org.eclipse.jetty.http.BadMessageException: 400: Unable to parse form content

      I tested with both the default -xmx settings (1024mb) but also an exaggerated value (6gb).

      The test file was generated using this website: https://testfiledownload.com/test-file-generator and it had the size of 5gb.

      Attachments

        Issue Links

          Activity

            [XWIKI-21923] "Unable to parse form content" error when trying to upload a large attachment with Jetty
            vmassol Vincent Massol added a comment -

            I'm closing as won't fix for now since the issue is a config one. What could be discussed is the default size of https://www.xwiki.org/xwiki/bin/view/FAQ/How%20to%20solve%20the%20%22Unable%20to%20parse%20form%20content%22%20error%20in%20Jetty

            However as mentioned there having a too-high value can be a risk:

            <!-- In order to avoid getting a "java.lang.IllegalStateException: Form too large" error when editing large page in
                   XWiki we need to tell Jetty to allow for large content since by default it only allows for 20K. We do this by
                   passing the "org.eclipse.jetty.server.Request.maxFormContentSize" attribute.
                   Note 1: Setting this value too high can leave your server vulnerable to denial of service attacks.
                   Note 2: We're setting it here instead of in Jetty's XML configuration files so that the XWiki WAR can be used
                   in any Jetty config and work out of the box.
              -->
            

            5120Mb is 640MB, right? That's quite high and I feel it's ok to not support this without a config option. WDYT?

            vmassol Vincent Massol added a comment - I'm closing as won't fix for now since the issue is a config one. What could be discussed is the default size of https://www.xwiki.org/xwiki/bin/view/FAQ/How%20to%20solve%20the%20%22Unable%20to%20parse%20form%20content%22%20error%20in%20Jetty However as mentioned there having a too-high value can be a risk: <!-- In order to avoid getting a "java.lang.IllegalStateException: Form too large" error when editing large page in XWiki we need to tell Jetty to allow for large content since by default it only allows for 20K. We do this by passing the "org.eclipse.jetty.server.Request.maxFormContentSize" attribute. Note 1: Setting this value too high can leave your server vulnerable to denial of service attacks. Note 2: We're setting it here instead of in Jetty's XML configuration files so that the XWiki WAR can be used in any Jetty config and work out of the box. --> 5120Mb is 640MB, right? That's quite high and I feel it's ok to not support this without a config option. WDYT?
            vmassol Vincent Massol added a comment - tcaras please see https://www.xwiki.org/xwiki/bin/view/FAQ/How%20to%20solve%20the%20%22Unable%20to%20parse%20form%20content%22%20error%20in%20Jetty

            People

              vmassol Vincent Massol
              tcaras Teodor Caras
              Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: