“软件导致连接中止:套接字写入错误”的官方原因 [英] Official reasons for "Software caused connection abort: socket write error"

查看:636
本文介绍了“软件导致连接中止:套接字写入错误”的官方原因的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

鉴于此堆栈跟踪代码段


引起:java.net.SocketException:
软件导致连接中止:
套接字写入错误
  at
java.net.SocketOutputStream.socketWrite0(Native
Method)

Caused by: java.net.SocketException: Software caused connection abort: socket write error
 at java.net.SocketOutputStream.socketWrite0(Native Method)

我试图回答以下问题:


  1. 什么代码是扔这个例外? (JVM?/ Tomcat?/我的代码?)

  2. 是什么原因导致抛出此异常?

关于#1:

Sun的JVM源代码不包含此确切消息,但我认为文本软件导致连接中止:套接字写入错误来自 SocketOutputStream的本机实现

Sun's JVM source doesn't contain this exact message, but I think the text Software caused connection abort: socket write error is from the native implementation of SocketOutputStream:

private native void socketWrite0(FileDescriptor fd, byte[] b, int off,
                 int len) throws IOException;

关于#2

我的猜测是,它是在客户端终止连接时,在获得完整响应之前引起的(例如发送请求,但在获得完整响应之前,它已关闭/终止/离线)

My guess is that it is caused when the client has terminated the connection, before getting the full response (e.g. sent a request, but before getting the full response, it got closed / terminated / offline)

问题:


  1. 上述假设是否正确(#1和#2)?

  2. 这可能与情况不同:由于服务器端的网络错误,无法写入客户端?或者会出现相同的错误消息吗?

  3. 最重要的是:是否有正式文件(例如来自Sun)说明上述内容?

  1. Are the above assumptions correct (#1 and #2)?
  2. Can this be diffrentiated from the situation: "could not write to the client, due to a network error on the server side"? or would that render the same error message?
  3. And most important: Is there an official document (e.g from Sun) stating the above?

我需要证明这个堆栈跟踪是套接字客户端的错误,并且服务器没有做任何事情来避免它。 (除了捕获异常,或者使用非Sun JVM SocketOutputStream,虽然两者都没有真正避免客户端终止的事实)

I need to have a proof that this stack trace is the socket client's "fault", and there is nothing that the server could have done to avoid it. (except catching the exception, or using a non Sun JVM SocketOutputStream, though both don't really avoid the fact the client has terminated)

推荐答案

本地网络系统中止连接时可能会发生此错误,例如,当数据重新传输失败后,WinSock关闭已建立的连接时(接收方永远不会确认数据流套接字上发送的数据)。请参阅此MSDN文章。另请参阅有关软件导致连接中止的一些信息

"This error can occur when the local network system aborts a connection, such as when WinSock closes an established connection after data retransmission fails (receiver never acknowledges data sent on a datastream socket).". See this MSDN article. See also Some information about 'Software caused connection abort'.

这篇关于“软件导致连接中止:套接字写入错误”的官方原因的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆