27

我尝试将大文件(400mb+)上传到wildfly 8.1,我得到一个IOException,但是在使用jboss 7服务器时我没有遇到任何相同条件的异常:

例外:

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)

我增加了最大帖子大小,但它没有用。

独立的.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>
4

5 回答 5

32

我已经找到了解决方案。我有同样的问题,我解决了。它可能会帮助其他人。

为了允许更多的 http 请求头大小,您需要更改 jboss 或 wildfly 的standalone.xml 文件。

将 max-header-size 属性添加到默认服务器并重新启动它将工作的服务器 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>
于 2015-04-15T14:52:35.207 回答
14

它不在“standalone.conf”文件中。它是位于文件夹“standalone/configuration”中的“standalone.xml”文件。更改最大后大小:

<http-listener name="default" socket-binding="http" redirect-socket="https" max-post-size="104857600"/>
            <host name="default-host" alias="localhost">
于 2016-07-25T07:27:17.817 回答
2

在 jboss 中查看此链接:https ://issues.jboss.org/browse/UNDERTOW-185

将设置 ../wildfly/stanadalone/configuration/standalone.xml 中的 max-post-size。

于 2017-11-01T17:01:33.560 回答
0

如果您的 wildfly 位于网络服务器 eq nginx 后面,您可能必须在那里设置限制。这对我有帮助。

于 2016-12-09T09:35:58.670 回答
0

使用 WildFly Web 控制台移动到:配置 -> 子系统 -> Web(Undertow) -> 服务器 -> 默认服务器单击“查看”按钮移动到“侦听器”选项卡编辑“HTTP 侦听器”和“HTTPS 侦听器”参数“max -post-size"

于 2022-01-19T11:21:58.830 回答