jetty.io.EofException java.io.IOException: Broken pipe

在apache + mod_proxy + jetty下,单台服务器,50并发情况下,jetty异常

Caused by: org.eclipse.jetty.io.EofException
        at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:912)
        at org.eclipse.jetty.http.AbstractGenerator.blockForOutput(AbstractGenerator.java:499)
        at org.eclipse.jetty.http.AbstractGenerator.flush(AbstractGenerator.java:430)
        at org.eclipse.jetty.server.HttpOutput.flush(HttpOutput.java:84)
        at org.eclipse.jetty.server.HttpConnection$Output.flush(HttpConnection.java:1140)
        at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:165)
        at org.eclipse.jetty.server.HttpOutput.write(HttpOutput.java:92)
        at java.io.ByteArrayOutputStream.writeTo(ByteArrayOutputStream.java:109)
        at org.eclipse.jetty.server.HttpWriter.write(HttpWriter.java:258)
        at org.eclipse.jetty.server.HttpWriter.write(HttpWriter.java:107)
        at org.eclipse.jetty.server.HttpWriter.write(HttpWriter.java:96)
        at org.eclipse.jetty.io.UncheckedPrintWriter.write(UncheckedPrintWriter.java:271)
        ... 35 more
Caused by: java.io.IOException: Broken pipe
        at sun.nio.ch.FileDispatcher.write0(Native Method)
        at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
        at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:72)
        at sun.nio.ch.IOUtil.write(IOUtil.java:28)
        at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
        at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:187)
        at org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:277)
        at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:856)
        ... 46 more

 

mod_proxy配置如下:

<IfModule mod_proxy.c>
    ProxyRequests Off
    ProxyPreserveHost On
    <Directory proxy:*>
        Order deny,allow
        Allow from all
    </Directory>

    ProxyPassMatch ^/(stream|user|friend|suggest|notice|upload|privatemsg|comment|common|search|score|ta|tfa)/(.*)$ http://localhost:8080 min=5 smax=16 ttl=6
00 timeout=100
</IfModule>

 找到两种解决方法,但都无法根治问题,实际上只是使得jetty不再抛出异常

1、在环境变量中设置: _JAVA_SR_SIGNUM = 12

参考:https://www.evernote.com/shard/s95/sh/33fe6db4-03a2-45d5-b7a3-6a6c35e5d864/a88a0f85148d56fe96e3b0df83ff7349

 

2、将jetty io类UncheckedPrintWriter crack掉

其中的属性_throwUnchecked=true正式控制异常是否向上抛出的开关,把它修改掉,然后将这个class单独打成jar包。

参考:http://benni82.iteye.com/blog/840878


你可能感兴趣的:(EOFException)