title: Android HttpUrlConnection EOFException
body: <p>I would like to know if there are known issues on Android with HttpUrlConnection and POST requests. We are experiencing <strong>intermittent</strong> EOFExceptions when making POST requests from an Android client. Retrying the same request will eventually work. Here is a sample stack trace:</p>
  
  <pre><code>java.io.EOFException
  at libcore.io.Streams.readAsciiLine(Streams.java:203)
  at libcore.net.http.HttpEngine.readResponseHeaders(HttpEngine.java:579)
  at libcore.net.http.HttpEngine.readResponse(HttpEngine.java:827)
  at libcore.net.http.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:283)
  at libcore.net.http.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:497)
  at libcore.net.http.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:134)
  </code></pre>
  
  <p>There are many similar bug reports and posts to stack overflow but I cannot understand if there really is an issue and if so, what versions of Android are affected and what the proposed fix/work around is.</p>
  
  <p>Here are some of the similar reports I am referring to:</p>
  
  <ul>
  <li><a href="https://stackoverflow.com/questions/15411213/android-httpsurlconnection-eofexception">Android HttpsUrlConnection eofexception</a></li>
  <li><a href="https://stackoverflow.com/questions/12319194/android-httpurlconnection-throwing-eofexception">Android HttpURLConnection throwing EOFException</a></li>
  <li><a href="https://stackoverflow.com/questions/17967731/eofexception-and-filenotfoundexception-in-httpurlconnection-getinputstream">EOFException and FileNotFoundException in HttpURLConnection getInputStream()</a></li>
  <li><a href="https://code.google.com/p/google-http-java-client/issues/detail?id=213" rel="nofollow noreferrer">https://code.google.com/p/google-http-java-client/issues/detail?id=213</a></li>
  <li><a href="https://code.google.com/p/android/issues/detail?id=29509" rel="nofollow noreferrer">https://code.google.com/p/android/issues/detail?id=29509</a></li>
  <li><a href="https://code.google.com/p/google-http-java-client/issues/detail?id=230" rel="nofollow noreferrer">https://code.google.com/p/google-http-java-client/issues/detail?id=230</a></li>
  <li><a href="https://code.google.com/p/android/issues/detail?id=41576" rel="nofollow noreferrer">https://code.google.com/p/android/issues/detail?id=41576</a></li>
  </ul>
  
  <p>Here is a potential Android framework fix</p>
  
  <ul>
  <li><a href="https://android.googlesource.com/platform/libcore/+/19aa40c81c48ff98ccc7272f2a3c41479b806376" rel="nofollow noreferrer">https://android.googlesource.com/platform/libcore/+/19aa40c81c48ff98ccc7272f2a3c41479b806376</a></li>
  </ul>
  
  <p>I do know there was an issue with poisoned connections in the connection pool in pre-Froyo but these issues are occurring on new ICS+ devices exclusively. If there were a problem on later devices I would expect some kind of official Android documentation of the issue.</p>