• Register
1 vote
166 views

Problem:

I am able to login through webservices api to particular account on 'Oracle on demand'.
When i tries to call 'accountQueryPage' method of the stub class (Stub class is generated with help Account.wsdl file), 

i got the following exception

java.net.SocketException: Software caused connection abort: recv failed

Can anyone give me some pointers.

10 7 2
6,060 points

Please log in or register to answer this question.

2 Answers

1 vote

Answer:

SocketException is a general exception the designates a problem when trying to access or open a Socket. 
So as you can imagine, solving that problem has to be done with extra care. 
You shall always log the error message that accompanies the exception. 
In the previous example we’ve seen the message code>Connection reset. 
This happens when on of the participants “violently” closes the connection without using close(). 
This means that you should check whether one of the participants has terminated unexpectedly. 
One slightly bizarre message can be Too many open files, especially when you run on Linux. 
This message designates that to many file descriptors are open to the system. 
You can avoid that error if you go to /etc/sysctl.conf and raise the number in fs.file-max field. 
Additionally, you can try to give more stack memory.

Of course many other messages can be met. For example "Bind error", 
where your connection cannot be established because the port cannot be bind to the socket. In that case check if the port is already in use etc.

Hope this helps.

11 6 4
34,950 points
0 votes

Solution:

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.

Don't use URL.open(), employ Apache-Commons HttpClient which has a retry mechanism, connection pooling, keep-alive and few other features.

Example usage:

HttpClient httpClient = HttpClients.custom()
            .setConnectionTimeToLive(20, TimeUnit.SECONDS)
            .setMaxConnTotal(400).setMaxConnPerRoute(400)
            .setDefaultRequestConfig(RequestConfig.custom()
                    .setSocketTimeout(30000).setConnectTimeout(5000).build())
            .setRetryHandler(new DefaultHttpRequestRetryHandler(5, true))
            .build();
// 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.
 

10 6 4
31,120 points

Related questions

2 votes
1 answer 34 views
34 views
Problem: I am able to login through webservices api to particular account on 'Oracle on demand'. When i tries to call 'accountQueryPage' method of the stub class (Stub class is generated with help Account.wsdl file), i got the following exception java.net.SocketException: Software caused connection abort: recv failed Can anyone give me some pointers.
asked Mar 24, 2020 LizzyM 6.1k points
0 votes
1 answer 63 views
63 views
Problem : I am struggling to find the solution for the bellow error java net socketexception software caused connection abort recv failed
asked Oct 31, 2019 peterlaw 6.9k points
0 votes
1 answer 413 views
413 views
Problem : I am getting bellow error while using Sockets java.net.socketexception: software caused connection abort: socket write error
asked Oct 19, 2019 peterlaw 6.9k points
0 votes
3 answers 6 views
6 views
Solution: I haven't been able to find an adequate answer to what exactly the following error means: java.net.SocketException: Software caused connection abort: recv failed Notes: This error is infrequent and unpredictable; although getting this error means that all future ... machine (Windows in this case). The URI is definitely available (as confirmed by asking the browser to do the fetch).
asked Feb 17 Ali 4.4k points
0 votes
2 answers 30 views
30 views
Help me by solving this question.
asked Jan 4 TeamScript 13.5k points
0 votes
1 answer 3 views
3 views
Problem: software caused connection abort: recv failed I haven't been able to find an adequate answer to what exactly the following error means: java.net.SocketException: Software caused connection abort: recv failed Notes: This error is infrequent and unpredictable; although getting this ... = (buffer = reader.readLine()) ) { result.append(buffer); }//end while: Got the contents. reader.close();
asked 1 day ago Hira 2.2k points
0 votes
1 answer 83 views
83 views
Problem: I am seeing "{writer,send_failed,{error,closed}}" error on server side and "java.net.SocketException: Connection reset by peer: socket write error" error on java client side intermittently. What could possibly go wrong here? Both server and ... rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:630) at com.rabbitmq.client.impl.ChannelN.basicPublish(ChannelN.java:621) Please help me.
asked Mar 23, 2020 LizzyM 6.1k points
0 votes
1 answer 245 views
245 views
Problem : I am trying to implement an HTTP Server using Sockets but getting bellow error java net socketexception connection reset by peer socket write error
asked Oct 31, 2019 peterlaw 6.9k points
0 votes
1 answer 4 views
4 views
Problem: I am trying to set up a java program that would send and receive a file. I know there are similar things for this problem on this website, It worked in his video, and I am not sure what I did wrong. The first java file runs just ... .SocketInputStream.read(Unknown Source) at fileSender.fileclient.main(fileclient.java:19) I tried using some other ports, but that did not solve the problem.
asked 3 days ago Ali 4.4k points
0 votes
1 answer 2 views
2 views
Problem: "java.net.SocketException: Network is unreachable " during Tomcat startup PlainSocketImpl.connect(PlainSocketImpl.java:182) at java.net he client is pingable form the server side.but the problem still exit. What can i do?
asked 1 day ago Ali 4.4k points