Official reasons for "Software caused connection abort: socket write error"

文章详细解析了Osgi与Log4j在尝试连接远程服务器时遇到的SSL连接中断错误,包括可能的原因分析及解决步骤。通过检查Windows事件日志和深入JVM源代码,可以定位问题并采取相应措施解决。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

osgi> log4j:ERROR Could not connect to remote log4j server at [localhost]. We will try again later.
javax.net.ssl.SSLException: Connection has been shutdown: javax.net.ssl.SSLException: java.net.SocketException: Software caused connection abort: socket write error
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkEOF(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.checkWrite(Unknown Source)
	at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
	at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source)
	at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(Unknown Source)
	at java.io.ObjectOutputStream.writeNonProxyDesc(Unknown Source)
	at java.io.ObjectOutputStream.writeClassDesc(Unknown Source)
	at java.io.ObjectOutputStream.writeOrdinaryObject(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.writeFatalException(Unknown Source)
	at java.io.ObjectOutputStream.writeObject(Unknown Source)
	at sexpert.server.impl.ParallelUtils.send(ParallelUtils.java:58)
	at sexpert.server.impl.APeerServer.run(APeerServer.java:67)
Caused by: javax.net.ssl.SSLException: java.net.SocketException: Software caused connection abort: socket write error
	at com.sun.net.ssl.internal.ssl.Alerts.getSSLException(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.fatal(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.handleException(Unknown Source)
	at com.sun.net.ssl.internal.ssl.AppOutputStream.write(Unknown Source)
	at java.io.ObjectOutputStream$BlockDataOutputStream.drain(Unknown Source)
	at java.io.ObjectOutputStream$BlockDataOutputStream.setBlockDataMode(Unknown Source)
	at java.io.ObjectOutputStream.writeObject0(Unknown Source)
	at java.io.ObjectOutputStream.writeObject(Unknown Source)
	at sexpert.server.fileTransfer.FileSender.sendFile(FileSender.java:69)
	at sexpert.server.impl.SExpertServer.handleMessageGetFile(SDMExpertServer.java:80)
	at sexpert.server.impl.SExpertServer.handleMessage(SDMExpertServer.java:336)
	at sexpert.server.impl.APeerServer.run(APeerServer.java:64)
Caused by: java.net.SocketException: Software caused connection abort: socket write error
	at java.net.SocketOutputStream.socketWrite0(Native Method)
	at java.net.SocketOutputStream.socketWrite(Unknown Source)
	at java.net.SocketOutputStream.write(Unknown Source)
	at com.sun.net.ssl.internal.ssl.OutputRecord.writeBuffer(Unknown Source)
	at com.sun.net.ssl.internal.ssl.OutputRecord.write(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecordInternal(Unknown Source)
	at com.sun.net.ssl.internal.ssl.SSLSocketImpl.writeRecord(Unknown Source)
	... 9 more

The answers of http://stackoverflow.com/questions/2126607/official-reasons-for-software-caused-connection-abort-socket-write-error

(1) You don't say so, but assuming that you see this on Windows, this Sun forum posting gives a general answer to the cause of these problems.

Anything that externally interrupts your network access can cause Windows to return "software caused connection abort". It's the "General Protection Fault" of network errors ...

The posting then goes on to suggest that you look in the Windows event log for the possible cause. So, in response for your questions I would say

  • The specific cause you hypothesize may or may not be correct. You'd need to do more research, starting with looking at the Windows Event Log.
  • You have not looked at the relevant part of the JVM source yet. You need to look at the implementations of the native methods. The source code is available.
  • There is no "official" Sun document that I can find that talks about this message. Try doing a search for the message using the site search on "java.sun.com".
  • If you need an "official" Sun diagnosis, you will need to get an support contract.
  • If you want real proof, you are out of luck. Problems as complicated as this are not amenable to proof using current theorem proving technology.

This is also caused when the connection was aborted instead of normally terminated.

(2) Not very well documented, but the call to Socket.close() causes the connection to be aborted. This results in this Exception on the other connection side, instead of generating an EOF condition while reading.

To start a TCP's normal connection termination sequence, the client (and server) should callSocket.shutdownOutput(), see the javadoc here. This causes the other side to get an EOF if reading from the Socket, which should also be followed by a call to shutdownOutput() before closing

即正常关闭Socket是一段调用socket.shutdownOutput()再进行socket.close(),另一端就会受到一个EOF。而如果一端直接调用socket.close(),另外一段就可能抛出socket write error 异常。


评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值