title: Official reasons for "Software caused connection abort: socket write error"
body: <p><strong>Given this stack trace snippet</strong></p>
  
  <blockquote>
    <p>Caused by: java.net.SocketException:
    Software caused connection abort:
    socket write error <br>&nbsp;at
    java.net.SocketOutputStream.socketWrite0(Native
    Method)</p>
  </blockquote>
  
  <p><strong>I tried to answer the following questions:</strong></p>
  
  <ol>
  <li>What code is throwing this exception? (JVM?/Tomcat?/My code?)</li>
  <li>What causes this exception to be thrown?</li>
  </ol>
  
  <p><strong>Regarding #1:</strong> </p>
  
  <p>Sun's JVM source doesn't contain this exact message, but I think the text <em>Software caused connection abort: socket write error</em> is from the native implementation of <code>SocketOutputStream</code>:</p>
  
  <pre><code>private native void socketWrite0(FileDescriptor fd, byte[] b, int off,
                   int len) throws IOException;
  </code></pre>
  
  <p><strong>Regarding #2</strong></p>
  
  <p>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)</p>
  
  <p><strong>Questions:</strong></p>
  
  <ol>
  <li>Are the above assumptions correct (#1 and #2)?</li>
  <li>Can this be diffrentiated from the situation: "could not write to the client, due to a network error on the <em>server</em> side"? or would that render the same error message?</li>
  <li>And most important: <strong>Is there an official document (e.g from Sun) stating the above?</strong></li>
  </ol>
  
  <p>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)</p>