27

I try to upload large files(400mb+) to wildfly 8.1 and i get an IOException but i dont encounter any exception with the same conditions when using jboss 7 server:

Exception:

Blocking request failed HttpServerExchange{ POST /ehub/contentstore/categories/maincategory/file/create}: java.lang.RuntimeException: java.io.IOException: Broken pipe
    at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:527)
    at io.undertow.servlet.handlers.ServletInitialHandler.handleFirstRequest(ServletInitialHandler.java:287)
    at io.undertow.servlet.handlers.ServletInitialHandler.dispatchRequest(ServletInitialHandler.java:227)
    at io.undertow.servlet.handlers.ServletInitialHandler.access$000(ServletInitialHandler.java:73)
    at io.undertow.servlet.handlers.ServletInitialHandler$1.handleRequest(ServletInitialHandler.java:146)
    at io.undertow.server.Connectors.executeRootHandler(Connectors.java:177)
    at io.undertow.server.HttpServerExchange$1.run(HttpServerExchange.java:727)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1145) [rt.jar:1.7.0_51]
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:615) [rt.jar:1.7.0_51]
    at java.lang.Thread.run(Thread.java:744) [rt.jar:1.7.0_51]
Caused by: java.io.IOException: Broken pipe
    at sun.nio.ch.FileDispatcherImpl.write0(Native Method) [rt.jar:1.7.0_51]
    at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:47) [rt.jar:1.7.0_51]
    at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:93) [rt.jar:1.7.0_51]
    at sun.nio.ch.IOUtil.write(IOUtil.java:51) [rt.jar:1.7.0_51]
    at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:487) [rt.jar:1.7.0_51]
    at org.xnio.nio.NioSocketConduit.write(NioSocketConduit.java:150) [xnio-nio-3.2.2.Final.jar:3.2.2.Final]
    at io.undertow.server.protocol.http.HttpResponseConduit.processWrite(HttpResponseConduit.java:212)
    at io.undertow.server.protocol.http.HttpResponseConduit.flush(HttpResponseConduit.java:629)
    at io.undertow.conduits.FinishableStreamSinkConduit.flush(FinishableStreamSinkConduit.java:83)
    at org.xnio.conduits.ConduitStreamSinkChannel.flush(ConduitStreamSinkChannel.java:162) [xnio-api-3.2.2.Final.jar:3.2.2.Final]
    at io.undertow.channels.DetachableStreamSinkChannel.flush(DetachableStreamSinkChannel.java:100)
    at org.xnio.channels.Channels.flushBlocking(Channels.java:63) [xnio-api-3.2.2.Final.jar:3.2.2.Final]
    at io.undertow.servlet.spec.ServletOutputStreamImpl.close(ServletOutputStreamImpl.java:625)
    at io.undertow.servlet.spec.HttpServletResponseImpl.closeStreamAndWriter(HttpServletResponseImpl.java:451)
    at io.undertow.servlet.spec.HttpServletResponseImpl.responseDone(HttpServletResponseImpl.java:525)

I increased the max-post-size but it didnt work.

standalone.xml :

<subsystem xmlns="urn:jboss:domain:undertow:1.1">
        <buffer-cache name="default"/>
        <server name="default-server">
            <http-listener name="default" socket-binding="http" max-post-size="974247881"/>
            <host name="default-host" alias="localhost">
                <location name="/" handler="welcome-content"/>
                <filter-ref name="server-header"/>
                <filter-ref name="x-powered-by-header"/>
            </host>
        </server>
        <servlet-container name="default">
            <jsp-config/>
        </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/8"/>
            <response-header name="x-powered-by-header" header-name="X-Powered-By" header-value="Undertow/1"/>
        </filters>
</subsystem>
semudu
  • 390
  • 1
  • 3
  • 9

5 Answers5

32

I have found solution for this. I had this same issue and I solved it. It may help others.

For allowing more http request header size you need to change standalone.xml file of jboss or wildfly.

Add max-header-size attribute to default server and restart the server it will work Standalone.conf

<subsystem xmlns="urn:jboss:domain:undertow:1.1">
        <buffer-cache name="default"/>
        <server name="default-server">
            <http-listener name="default" socket-binding="http" max-header-size="974247881"/>
            <host name="default-host" alias="localhost">
                <location name="/" handler="welcome-content"/>
                <filter-ref name="server-header"/>
                <filter-ref name="x-powered-by-header"/>
            </host>
        </server>
...
</subsystem>
alegria
  • 931
  • 2
  • 10
  • 25
kirti
  • 4,499
  • 4
  • 31
  • 60
  • 2
    see [official docs](https://docs.jboss.org/author/display/WFLY10/Undertow+subsystem+configuration), max-post-size is 10MB by default (size is in bytes) – Gregor Dec 21 '17 at 13:40
  • @Gregor I can't see default value for max-post-size in the linked documentation. Did you find it somewhere? Couldn't find it here either: https://docs.jboss.org/author/display/WFLY/Undertow+subsystem+configuration – Vasil Svetoslavov Apr 12 '19 at 10:17
  • @VasilSvetoslavov it's still there, under "Common settings" in the table: > max-post-size The maximum size of incoming post requests that is allowed. – Gregor Apr 12 '19 at 13:41
  • @Gregor The setting is indeed there. I meant there is no default value described anywhere. Not that I don't trust you about the 10MB, but I just don't see it in the docs. Screenshot here (just in case we are speaking about different things): https://pasteboard.co/Ibt17Ec.png – Vasil Svetoslavov Apr 23 '19 at 12:59
  • you're right @VasilSvetoslavov I missed that. So it is at least documented in the issue linked by M2E67 below, don't know where I got it from initially. See https://issues.jboss.org/browse/UNDERTOW-185 – Gregor Apr 24 '19 at 15:42
14

It is not in "standalone.conf" file . It is "standalone.xml" file which is located in folder "standalone/configuration". change max-post-size :

<http-listener name="default" socket-binding="http" redirect-socket="https" max-post-size="104857600"/>
            <host name="default-host" alias="localhost">
Ritesh Shah
  • 141
  • 1
  • 2
2

see this link in jboss: https://issues.jboss.org/browse/UNDERTOW-185

max-post-size in ../wildfly/stanadalone/configuration/standalone.xml will be set.

M2E67
  • 937
  • 7
  • 23
0

If your wildfly stands behind webserver, e.q. nginx, you may have to set the limit there. This helped me.

fidel
  • 11
  • 1
0

Using the WildFly web console move to: Configuration -> Subsystems -> Web(Undertow) -> Server -> default-server click "View" button move to "Listener" tab edit "HTTP Listener" and "HTTPS Listener" parameter "max-post-size"