java.net.SocketException: Connection reset 和 java.net.SocketException: Broken Pipe 有什么区别?

2022-09-03 15:01:43

java.net.SocketException: Connection reset 和 ?java.net.SocketException: Broken Pipe

我试图弄清楚这两个例外的原因是什么。我们在服务器上收到以下错误,这基本上是一个基于肥皂的Web服务。当我尝试中止客户端调用时,我看到的异常是管道损坏...

以下是我们进行堆栈跟踪,任何帮助都值得赞赏!

2011-01-10 00:44:33,828 96893947 INFO  [STDOUT] (http-0.0.0.0-8180-Processor25:) ERROR:  ''
2011-01-10 00:44:33,829 96893948 INFO  [STDOUT] (http-0.0.0.0-8180-Processor25:) Jan 10, 2011 12:44:33 AM com.sun.xml.rpc.server.http.JAXRPCS
ervletDelegate doGetDefault
SEVERE: JAXRPCSERVLET34: transformation failed : ClientAbortException:  java.net.SocketException: Connection reset
JAXRPCSERVLET34: transformation failed : ClientAbortException:  java.net.SocketException: Connection reset
        at com.sun.xml.rpc.server.http.WSDLPublisher.handle(WSDLPublisher.java:109)
        at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doGetDefault(JAXRPCServletDelegate.java:185)
        at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doGet(JAXRPCServletDelegate.java:153)
        at com.sun.xml.rpc.server.http.JAXRPCServlet.doGet(JAXRPCServlet.java:111)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
--
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpoint.java:527)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFollowerWorkerThread.java:80)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadPool.java:684)
        at java.lang.Thread.run(Thread.java:595)
2011-01-10 00:44:33,829 96893948 ERROR [org.apache.catalina.core.ContainerBase.[jboss.web].[localhost].[/soa].[UserService]] (http-0.0.0.0-81
80-Processor25:) Servlet.service() for servlet UserService threw exception
javax.servlet.ServletException: JAXRPCSERVLET34: transformation failed : ClientAbortException:  java.net.SocketException: Connection reset
        at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doGetDefault(JAXRPCServletDelegate.java:347)
        at com.sun.xml.rpc.server.http.JAXRPCServletDelegate.doGet(JAXRPCServletDelegate.java:153)
        at com.sun.xml.rpc.server.http.JAXRPCServlet.doGet(JAXRPCServlet.java:111)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:697)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:810)

答案 1

读取或写入时可能会发生“连接重置”。“管道断裂”只能在写入时发生。两者都是由写入已被另一端关闭的连接或由于某些其他原因而重置的连接引起的。


答案 2

当对等体(即应用程序在另一端保持连接)关闭连接时,两者都会发生。Connection resetBroken pipe

Connection reset可以在写入(参见 java.net.SocketOutputStream)或读取(参见 java.net.SocketInputStream)时发生。

Broken pipe在 以下的本机方法中发生:java.net.SocketException

java.net.SocketException: Broken pipe
    at java.net.SocketOutputStream.socketWrite0(Native Method)
    at java.net.SocketOutputStream.socketWrite(SocketOutputStream.java:92)

因此,正如Michael Borgwardt所建议的那样,发生在较低的沟通层面。Broken pipe

在大多数情况下,当我将一个大的PDF发送到客户端浏览器时,我看到这个错误,用户在获取整个文档之前杀死了浏览器(在这种情况下,我只是忽略这个错误,因为这是用户选择关闭其浏览器,没有什么可纠正的)。但这可能是其他原因(例如,EJP建议更多与数据通信协议有关的原因)。


推荐