could not get to increase the max post size in wildfly 12 above 250 MB

1.9k Views Asked by At
14:55:23,465 ERROR [stderr] (default task-1) io.undertow.server.RequestTooBigException: UT000020: Connection terminated as request was larger than 209715200
14:55:23,465 ERROR [stderr] (default task-1)    at io.undertow.conduits.FixedLengthStreamSourceConduit.checkMaxSize(FixedLengthStreamSourceConduit.java:168)
14:55:23,465 ERROR [stderr] (default task-1)    at io.undertow.conduits.FixedLengthStreamSourceConduit.read(FixedLengthStreamSourceConduit.java:229)
14:55:23,465 ERROR [stderr] (default task-1)    at org.xnio.conduits.ConduitStreamSourceChannel.read(ConduitStreamSourceChannel.java:127)
14:55:23,465 ERROR [stderr] (default task-1)    at io.undertow.channels.DetachableStreamSourceChannel.read(DetachableStreamSourceChannel.java:209)
14:55:23,466 ERROR [stderr] (default task-1)    at io.undertow.server.HttpServerExchange$ReadDispatchChannel.read(HttpServerExchange.java:2337)
14:55:23,466 ERROR [stderr] (default task-1)    at org.xnio.channels.Channels.readBlocking(Channels.java:294)
14:55:23,466 ERROR [stderr] (default task-1)    at io.undertow.servlet.spec.ServletInputStreamImpl.readIntoBuffer(ServletInputStreamImpl.java:192)
14:55:23,466 ERROR [stderr] (default task-1)    at io.undertow.servlet.spec.ServletInputStreamImpl.read(ServletInputStreamImpl.java:168)
14:55:23,466 ERROR [stderr] (default task-1)    at org.apache.commons.fileupload.MultipartStream$ItemInputStream.makeAvailable(MultipartStream.java:1027)
14:55:23,466 ERROR [stderr] (default task-1)    at org.apache.commons.fileupload.MultipartStream$ItemInputStream.read(MultipartStream.java:931)
14:55:23,466 ERROR [stderr] (default task-1)    at java.io.InputStream.read(InputStream.java:101)
14:55:23,466 ERROR [stderr] (default task-1)    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:98)
14:55:23,467 ERROR [stderr] (default task-1)    at org.apache.commons.fileupload.util.Streams.copy(Streams.java:68)

Here is the appropriate configuration in standalone.xml Where max-post-size is set to "1073741824" bytes (wanted 1GB) Is there an underlying limit of 200MB? With the whole file search for this 209715200, inside wildfly server folder, i did not find any.

<subsystem xmlns="urn:jboss:domain:undertow:5.0">
            <buffer-cache name="default"/>
            <server name="default-server">
                <http-listener name="default" socket-binding="http" max-post-size="1073741824" redirect-socket="https" enable-http2="true" no-request-timeout="600000" />
                <https-listener name="https" socket-binding="https" security-realm="ApplicationRealm" enable-http2="true"/>
                <host name="default-host" alias="localhost">
                    <location name="/" handler="welcome-content"/>
                    <filter-ref name="server-header"/>
                    <filter-ref name="x-powered-by-header"/>
                    <http-invoker security-realm="ApplicationRealm"/>
                </host>
            </server>
            <servlet-container name="default">
                <jsp-config/>
                <websockets/>
            </servlet-container>
            <handlers>
                <file name="welcome-content" path="${jboss.home.dir}/welcome-content"/>
            </handlers>
            <filters>
                <response-header name="server-header" header-name="Server" header-value="WildFly/11"/>
                <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
            </filters>
        </subsystem>
1

There are 1 best solutions below

3
gsakthivel On

There is a command line interface (jboss server bin folder). Updating the size using that command line is working. following is the command to set it approximately above 700MB In the wildfly server bin folder, since I am on Windows, there is a jboss-cli.bat If we run it, and connect, then we can do the following command to set it. /subsystem=undertow/server=default-server/http-listener=default/:write-attribute(name=max-post-size,value=754857600)

we can also do read-attribute without any parameters to see what has been set now

Another crazy thing was this project was using very old struts (1.3.x). This struts framework has a default file upload size limit of 250MB. With the whole internet (and myself) forgot about struts 1.x, this was hard to find. Anyways, the controller settings in struts-config.xml has a maxFileSize setting that we can set to. Otherwise, the default size is 250MB. <controller ... maxFileSize="750M" .../> will override the default.