Working download code gives "SocketException: Software caused connection abort" in Android 16 devices [duplicate]

3 days ago 7
ARTICLE AD BOX

Given this stack trace snippet

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

I tried to answer the following questions:

What code is throwing this exception? (JVM?/Tomcat?/My code?) What causes this exception to be thrown?

Regarding #1:

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;

Regarding #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)

Questions:

Are the above assumptions correct (#1 and #2)? Can this be differentiated 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?

And most important: Is there an official document (e.g from Sun) stating the above?

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)

Dale K's user avatar

Dale K

28.3k15 gold badges62 silver badges87 bronze badges

asked Jan 24, 2010 at 9:52

Eran Medan's user avatar

4

Read Entire Article