This generally refers that there was a network error, like a TCP timeout. I would begin by fixing a sniffer (wireshark) on the connection to see in case you can see any problems. In case there is a TCP error, you must be able to see it. Further, you can inspect your router logs, in case this is applicable. In case wireless is engaged anywhere, that is another source for these kind of errors.
This also occurs in case your TLS client is unable to be authenticate by the server configured to claim client authentication.
This error happens when a connection is closed abruptly (when a TCP connection is reset while there is still data in the send buffer). The condition is very same to a much more usual 'Connection reset by peer'. It can occur sporadically when connecting over the Internet, however also systematically in case the timing is right (for example- with keep-alive connections on localhost).
An HTTP client must only re-open the connection and retry the request. It is significant to understand that when a connection is in this state, there is no way out of it other than to close it. Any try to send or receive will generate the same error.
URL.open(), employ Apache-Commons HttpClient which has a retry mechanism, connection pooling, keep-alive and few other features.
HttpClient httpClient = HttpClients.custom()
.setRetryHandler(new DefaultHttpRequestRetryHandler(5, true))
// the httpClient should be re-used because it is pooled and thread-safe.
HttpGet request = new HttpGet(uri);
HttpResponse response = httpClient.execute(request);
reader = new BufferedReader(new InputStreamReader(response.getEntity().getContent()));
// handle response ...
Inspect why your client is sending the second request before reading the response of the first request. Find for any multi-threading angle in case the error is alternate.
I have also seen this error while performing with a Java Web application linking to database. At the time you left your application overnight and there is no request to scheme during the night, in the morning it was casting "java.sql.SQLException: Communication link failure: java.net.SocketException, underlying reason: Software involved connection abort: recv failed" error.
The real reason of the problem was that database timed out the connection at the time left idle and when Java application attempts to link to the database employing those stale connection it throws java.sql.SQLException: Communication link failure: java.net.SocketException, underlying reason: Software caused connection abort: recv failed error.
Because we were employing the c3po connection pool from Hibernate and enabled connection.autoReconnect, connection.autoReconnectForPools, and connection.is-connection-validation-required set, I was surprising why this issue is coming even in case we auto connect enabled. The real cause was that we have not provided the validationQuery property and JDBC drivers require validation query to test the connection at the time the idle period.
You can exercise queries like "SELECT 1" or "SELECT 1 from DUAL" relying upon which database you are connecting In our instance, it was Microsoft SQL SERVER 2008 however this error can occur with any database for example MySQL or Oracle. Exercise the second validation query in case you are linking to Oracle database from Java application employing the c3p0 connection pool.
In case you are not using c3p0 however employing Apache DBCP connection pool for example employing org.apache.commons.dbcp.BasicDataSource in your Spring config file then uses topical property so that JDBC connection pool can automatically test the pooled database connection.
That's all about java.net.SocketException: Software caused connection abort: recv failed". You see the origin reason is that one party, generally the server has closed the connection however the client is attempting to read from that connection. I understand the every condition is diverse and it may claim different solution however knowing this fundamental will help you to shortly troubleshoot your issue.