今天碰到一个异常,代码如下:
java.io.IOException: 没有进程来读取写入管道的数据。 at sun.nio.ch.FileDispatcher.write0(Native Method) at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:57) at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:132) at sun.nio.ch.IOUtil.write(IOUtil.java:103) at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:362) at org.eclipse.jetty.io.nio.ChannelEndPoint.flush(ChannelEndPoint.java:219) at org.eclipse.jetty.io.nio.SelectChannelEndPoint.flush(SelectChannelEndPoint.java:282) at org.eclipse.jetty.http.HttpGenerator.flushBuffer(HttpGenerator.java:849) at org.eclipse.jetty.server.HttpConnection.flushResponse(HttpConnection.java:753) at org.eclipse.jetty.server.Response.flushBuffer(Response.java:991) at org.eclipse.jetty.servlet.DefaultServlet.passConditionalHeaders(DefaultServlet.java:686) at org.eclipse.jetty.servlet.DefaultServlet.doGet(DefaultServlet.java:490) at javax.servlet.http.HttpServlet.service(HttpServlet.java:707) 英文异常是: java.io.IOException: There is no process to read data written to a pipe
jetty服务器部署在AIX上面,通过程序发送请求给jetty服务器。
原因分析:
客户端在发送请求给jetty服务器后,会等待jetty服务器的响应,但是由于这个请求处理很慢,请求的响应不能及时的返回给客户端。客户端在等待一段时间后,决定终止请求,并关闭了TCP连接。在关闭TCP请求后的某个时间,jetty服务器处理完了这个请求,把响应尝试写回给客户端,但是这时已经不能成功写回了,返回的数据写入了AIX服务器的套接字缓存中,所有会报IO异常。
参考文章:
http://os.chinaunix.net/a2007/0325/1058/000001058529.shtml