Given this stack trace snippet
Caused by: java.net.SocketException: Software caused connection abort: socket write error
&nbs
In my case, the error was:
java.net.SocketException: Software caused connection abort: recv failed
It was received in eclipse while debugging a java application accessing a H2 database. The source of the error was that I had initially opened the database with SQuirreL to check manually for integrity. I did use the flag to enable multiple connections to the same DB (i.e. AUTO_SERVER=TRUE
), so there was no problem connecting to the DB from java.
The error appeared when, after a while --it is a long java process-- I decided to close SQuirreL to free resources. It appears as if SQuirreL were the one "owning" the DB server instance and that it was shut down with the SQuirreL connection.
Restarting the Java application did not yield the error again.
config
I was facing the same problem with wireMock while mocking the rest API calls. Earlier I was defining the server like this:
WireMockServer wireMockServer = null;
But it should be defined like as shown below:
@Rule
public WireMockRule wireMockRule = new WireMockRule(8089);
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'.
ssl client side will throw such exception in below situation(I had tested), :
server is asked to authenticate client certificate, but the client provide a certificate which Extended Key Usage donot support client auth.
I have seen this most often when a corporate firewall on a workstation/laptop gets in the way, it kills the connection.
eg. I have a server process and a client process on the same machine. The server is listening on all interfaces (0.0.0.0) and the client attempts a connection to the public/home interface (note not the loopback interface 127.0.0.1).
If the machine is has its network disconnected (eg wifi turned off) then the connection is formed. If the machine is connected to the corporate network (directly or vpn) then the connection is formed.
However, if the machine is connected to a public wifi (or home network) then the firewall kicks in an kills the connection. In this situation connecting the client to the loopback interface works fine, just not to the home/public interface.
Hope this helps.
For anyone using simple Client Server programms and getting this error, it is a problem of unclosed (or closed to early) Input or Output Streams.