question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

EOF Exception Android API 14+ , URLConnection

See original GitHub issue

From chris.mark.jenkins@gmail.com on March 27, 2013 08:55:20

Version of google-http-java-client (e.g. 1.5.0-beta)? 1.13.1-beta Java environment (e.g. Java 6, Android 2.3, App Engine)? Java 6, Android 4.X (Galaxy Nexus, Nexus 4, Nexus 7, Samsung S2) (Real devices NOT AVD). Describe the problem. Connection spoiling the header by leaving an old connection open. See attached forum post: https://groups.google.com/forum/?fromgroups=#!topic/android-developers/e_FExl6jl90 This is a sporadic bug, but “looks” like the connection terminated the connection randomly when it appears that the old connection is not “cleaned” properly. How would you expect it to be fixed? As mentioned in the forum post I am fixing the request with the following method when creating the request.

public static void tryToFixNetHttpRequest(final HttpHeaders headers)
{
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH)
            try
            {
                headers.set("Connection", "close");
            }
            catch (Exception e)
            {
            }
}

So far I am yet to see the error again. We can of course use this as a work around on android, but a better solution would be more appropriate.

_Original issue: http://code.google.com/p/google-http-java-client/issues/detail?id=213_

Issue Analytics

  • State:closed
  • Created 9 years ago
  • Comments:12 (9 by maintainers)

github_iconTop GitHub Comments

1reaction
wonderflycommented, Jan 9, 2015

From james.w…@gmail.com on May 21, 2014 18:14:31

I was able to work around this problem using a retry mechanism. The trick is to ensure that the number of retries corresponds with the “http.maxConnections” system property. I shared the code here: http://stackoverflow.com/a/23795099/204480

0reactions
sduskiscommented, Mar 8, 2019

This issue is super old. I’m going to close this. If someone comes along, and sees this, please open a new issue.

Read more comments on GitHub >

github_iconTop Results From Across the Web

android - Getting java.io.EOFException using HttpUrlConnection
I am getting EOFException when I call a REST API. I know it says that response is null. But it should not. I...
Read more >
EOFException - Android Developers
EOFException ; EOFException. Added in API level 1 ... Public constructors. EOFException(). Constructs an EOFException with null as its error detail message.
Read more >
How to Fix the EOFException in Java.io - Rollbar
EOFException is a checked exception in Java that occurs when an end of file or end of stream is reached unexpectedly during input....
Read more >
java.io.EOFException Java Examples - ProgramCreek.com
This page shows Java code examples of java.io.EOFException.
Read more >
HttpURLConnection shouldnt throw EOF exception for errors.
to a HttpURLConnection and try and call getResponseCode the first time you get an EOFException... If you call it again you get the...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found