New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

EOFException in RealBufferedSource.readUtf8LineStrict #1114

Closed
swankjesse opened this Issue Nov 1, 2014 · 99 comments

Comments

@swankjesse
Member

swankjesse commented Nov 1, 2014

A few people have reported this. Needs investigation & fix.

java.io.EOFException: null
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:154) ~[na:0.0]
    at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:189) ~[na:0.0]
    at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101) ~[na:0.0]
    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:676) ~[na:0.0]
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:426) ~[na:0.0]
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:371) ~[na:0.0]
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:466) ~[na:0.0]
    at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105) ~[na:0.0]

@swankjesse swankjesse added this to the 2.1 milestone Nov 1, 2014

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Nov 5, 2014

Member

I haven't been able to reproduce this. Punting to 2.2.

Member

swankjesse commented Nov 5, 2014

I haven't been able to reproduce this. Punting to 2.2.

@swankjesse swankjesse modified the milestones: 2.2, 2.1 Nov 5, 2014

@swankjesse swankjesse added the bug label Nov 11, 2014

@niqo01

This comment has been minimized.

Show comment
Hide comment
@niqo01

niqo01 Nov 27, 2014

@swankjesse I am seeing a few of those in production. How can I help debugging?

niqo01 commented Nov 27, 2014

@swankjesse I am seeing a few of those in production. How can I help debugging?

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Nov 28, 2014

Member

@niqo01 can you reproduce locally or are you getting this through Crashlytics/Bugsnag etc. ?

Member

swankjesse commented Nov 28, 2014

@niqo01 can you reproduce locally or are you getting this through Crashlytics/Bugsnag etc. ?

@niqo01

This comment has been minimized.

Show comment
Hide comment
@niqo01

niqo01 Nov 28, 2014

@swankjesse Getting through Crashlytics only. If you think about logs which would help debugging, I would be glad to add them to the next release.

niqo01 commented Nov 28, 2014

@swankjesse Getting through Crashlytics only. If you think about logs which would help debugging, I would be glad to add them to the next release.

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Nov 29, 2014

Member

@niqo01 any pattern in device maker or Android version?

I'll add something to OkHttp itself to provide more context when this is triggered.

Member

swankjesse commented Nov 29, 2014

@niqo01 any pattern in device maker or Android version?

I'll add something to OkHttp itself to provide more context when this is triggered.

@niqo01

This comment has been minimized.

Show comment
Hide comment
@niqo01

niqo01 Nov 29, 2014

@swankjesse you can have a look at the crashlytics report here: http://crashes.to/s/816499ead0b
I didn't recognized a possible pattern in device maker or Android version or specific HTTP request.

niqo01 commented Nov 29, 2014

@swankjesse you can have a look at the crashlytics report here: http://crashes.to/s/816499ead0b
I didn't recognized a possible pattern in device maker or Android version or specific HTTP request.

@floating-cat

This comment has been minimized.

Show comment
Hide comment
@floating-cat

floating-cat Dec 1, 2014

OkHttp 2.1.
Device: Coolpad 8297.
Version: Android 4.2.2.
Same issues. I can confirm this device would cause this EOFException (my two users have this device reported this).

This is the one user's device's info. I hope this may help you.

Model number                      Coolpad 8297
Android version                   4.2.2 MIUI V5
MIUI version (An android rom)     MIUI-4.9.26
Processor                         8-core 1.7GHZ
RAM                               2.00 GB
ROM                               8.00 GB
Baseband version                  MOLY.WR8.W1315.MD.W
                                  G.MP.V19.P2,2014/03/11
                                                   00:55
Kernel version                    3.4.39

Simliar comment can be found here:
#803 (comment)

OkHttp 2.1.
Device: Coolpad 8297.
Version: Android 4.2.2.
Same issues. I can confirm this device would cause this EOFException (my two users have this device reported this).

This is the one user's device's info. I hope this may help you.

Model number                      Coolpad 8297
Android version                   4.2.2 MIUI V5
MIUI version (An android rom)     MIUI-4.9.26
Processor                         8-core 1.7GHZ
RAM                               2.00 GB
ROM                               8.00 GB
Baseband version                  MOLY.WR8.W1315.MD.W
                                  G.MP.V19.P2,2014/03/11
                                                   00:55
Kernel version                    3.4.39

Simliar comment can be found here:
#803 (comment)

@simtse

This comment has been minimized.

Show comment
Hide comment
@simtse

simtse Dec 11, 2014

Hello @swankjesse , what I don't understand is why the error comes so quickly and not seeing a response log.

My experience is that either my server is down or a problem connecting to the server because of spotty connection that causes an EOFException for me.

12-10 17:21:27.453 30472-30652/? D/Retrofit log﹕ ---> HTTP POST https://placeholder.server.com//core/b1c51a7ec5204/
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ User-Agent: Android
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ Content-Type: application/json; charset=UTF-8
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ Content-Length: 121
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ ---> END HTTP (121-byte body)
12-10 17:21:29.275 30472-30652/? D/Retrofit log﹕ ---- ERROR https://placeholder.server.com//core/b1c51a7ec5204/
12-10 17:21:29.295 30472-30652/? D/Retrofit log﹕ java.io.EOFException
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:154)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:189)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)

simtse commented Dec 11, 2014

Hello @swankjesse , what I don't understand is why the error comes so quickly and not seeing a response log.

My experience is that either my server is down or a problem connecting to the server because of spotty connection that causes an EOFException for me.

12-10 17:21:27.453 30472-30652/? D/Retrofit log﹕ ---> HTTP POST https://placeholder.server.com//core/b1c51a7ec5204/
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ User-Agent: Android
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ Content-Type: application/json; charset=UTF-8
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ Content-Length: 121
12-10 17:21:27.463 30472-30652/? D/Retrofit log﹕ ---> END HTTP (121-byte body)
12-10 17:21:29.275 30472-30652/? D/Retrofit log﹕ ---- ERROR https://placeholder.server.com//core/b1c51a7ec5204/
12-10 17:21:29.295 30472-30652/? D/Retrofit log﹕ java.io.EOFException
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:154)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:189)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)

@pflammertsma

This comment has been minimized.

Show comment
Hide comment
@pflammertsma

pflammertsma Dec 11, 2014

@swankjesse In the previous issue (#803), you theorized:

At first glance it looks like bad connection reuse, but that should be recovered from & retried automatically. Is this a POST request?

Are you referring to the fact that if the response gives HTTP 100 (HttpConnection:199), HttpConnection continues the loop to parse the StatusLine again (HttpConnection:187)?

I've attached the debugger to see if that's the case, and it's not; the exception is thrown the first time around, in my case on a HTTP 204.

I've been trying to put together a minimum working example of this problem, but to no avail. I'm only seeing it in a production environment where the API returns HTTP 204 with an empty body on a POST request.

I'm suspicious that perhaps the response coming in contains no newline '\n' character at all, as looking at RealBufferedSource:192 suggests that's the only cause of this exception. As the HTTP response should always contain at least one such character following the header, I'm properly puzzled.

On OkHttp 2.1.0, the line numbers appear to be slightly different; my stack trace is:

java.io.EOFException
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:192)
    at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
    at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:78)
    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:665)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:429)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:374)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:469)
    at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
    at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
    at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
    at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
    at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
    [...]

@swankjesse In the previous issue (#803), you theorized:

At first glance it looks like bad connection reuse, but that should be recovered from & retried automatically. Is this a POST request?

Are you referring to the fact that if the response gives HTTP 100 (HttpConnection:199), HttpConnection continues the loop to parse the StatusLine again (HttpConnection:187)?

I've attached the debugger to see if that's the case, and it's not; the exception is thrown the first time around, in my case on a HTTP 204.

I've been trying to put together a minimum working example of this problem, but to no avail. I'm only seeing it in a production environment where the API returns HTTP 204 with an empty body on a POST request.

I'm suspicious that perhaps the response coming in contains no newline '\n' character at all, as looking at RealBufferedSource:192 suggests that's the only cause of this exception. As the HTTP response should always contain at least one such character following the header, I'm properly puzzled.

On OkHttp 2.1.0, the line numbers appear to be slightly different; my stack trace is:

java.io.EOFException
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:192)
    at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
    at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:78)
    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:665)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:429)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:374)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:469)
    at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
    at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
    at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
    at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
    at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
    [...]
@ArthurSav

This comment has been minimized.

Show comment
Hide comment
@ArthurSav

ArthurSav Dec 18, 2014

Is there a fix for this? I get the exception quite often

java.io.EOFException
            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:192)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:78)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:665)
            at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:429)
            at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:374)
            at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:469)
            at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
            at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
            at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:818)

Is there a fix for this? I get the exception quite often

java.io.EOFException
            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:192)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:78)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:665)
            at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:429)
            at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:374)
            at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:469)
            at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
            at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
            at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:818)
@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Dec 28, 2014

Member

This might add some context:
square/okio#104

Member

swankjesse commented Dec 28, 2014

This might add some context:
square/okio#104

@pflammertsma

This comment has been minimized.

Show comment
Hide comment
@pflammertsma

pflammertsma Dec 28, 2014

Yes, this would indeed be useful. I haven't grabbed the latest for a new test, but it seems that the newline is missing in empty body responses (such as HTTP 204) from some servers. Oddly, it's entirely random.

I'll dump the new exception when I encounter it again.

Yes, this would indeed be useful. I haven't grabbed the latest for a new test, but it seems that the newline is missing in empty body responses (such as HTTP 204) from some servers. Oddly, it's entirely random.

I'll dump the new exception when I encounter it again.

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Dec 29, 2014

Member

Might be caused by attempting to parse SPDY or HTTP/2.0 as HTTP/1.1. We had a bug on desktop Java where our ALPN implementation wasn't always telling us the negotiated protocol.

With the new information in-hand from Okio's update, I'm going to punt this to 2.3 since there's no further action to take for the 2.2 release.

Member

swankjesse commented Dec 29, 2014

Might be caused by attempting to parse SPDY or HTTP/2.0 as HTTP/1.1. We had a bug on desktop Java where our ALPN implementation wasn't always telling us the negotiated protocol.

With the new information in-hand from Okio's update, I'm going to punt this to 2.3 since there's no further action to take for the 2.2 release.

@swankjesse swankjesse modified the milestones: 2.3, 2.2 Dec 29, 2014

@johnjohndoe

This comment has been minimized.

Show comment
Hide comment
@pflammertsma

This comment has been minimized.

Show comment
Hide comment
@pflammertsma

pflammertsma Jan 8, 2015

@swankjesse After many (many!) tries where everything just works hunky dory, I've finally gotten it to fail again with OkHttp 2.2. I don't know what to say than that it appears to be completely at random.

As with @johnjohndoe's report, the buffer is simply empty. Unlike his report, this is coming from a Apache 2.2.15 on CentOS, running PHP 5.4.36.

java.io.EOFException: \n not found: size=0 content=...
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
    at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
    at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
    at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:791)
    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:678)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:431)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:376)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:471)
    at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
    at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
    at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
    at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
    at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
    at $Proxy2.locationFinishSession(Native Method)
    at com.vebego.ally.proxies.LocationSessionProxy$2.doRequest(LocationSessionProxy.java:47)
    at com.vebego.ally.SyncService$2.doInBackground(SyncService.java:269)
    at com.vebego.ally.SyncService$2.doInBackground(SyncService.java:259)
    at android.os.AsyncTask$2.call(AsyncTask.java:288)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:841)

@swankjesse After many (many!) tries where everything just works hunky dory, I've finally gotten it to fail again with OkHttp 2.2. I don't know what to say than that it appears to be completely at random.

As with @johnjohndoe's report, the buffer is simply empty. Unlike his report, this is coming from a Apache 2.2.15 on CentOS, running PHP 5.4.36.

java.io.EOFException: \n not found: size=0 content=...
    at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
    at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
    at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
    at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:791)
    at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:678)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:431)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:376)
    at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:471)
    at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
    at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
    at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
    at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
    at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
    at retrofit.RestAdapter$RestHandler.invoke(RestAdapter.java:240)
    at $Proxy2.locationFinishSession(Native Method)
    at com.vebego.ally.proxies.LocationSessionProxy$2.doRequest(LocationSessionProxy.java:47)
    at com.vebego.ally.SyncService$2.doInBackground(SyncService.java:269)
    at com.vebego.ally.SyncService$2.doInBackground(SyncService.java:259)
    at android.os.AsyncTask$2.call(AsyncTask.java:288)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at android.os.AsyncTask$SerialExecutor$1.run(AsyncTask.java:231)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
    at java.lang.Thread.run(Thread.java:841)
@pflammertsma

This comment has been minimized.

Show comment
Hide comment
@pflammertsma

pflammertsma Jan 8, 2015

Perhaps it would be useful for logging that the headers are output before the rest of the response body is attempted to be read? Presently, it bombs out with the ---- ERROR message line immediately after the ---> END HTTP line.

The issue is so terribly difficult to reproduce that I can't attach the debugger and hope for it to occur on a breakpoint.

Perhaps it would be useful for logging that the headers are output before the rest of the response body is attempted to be read? Presently, it bombs out with the ---- ERROR message line immediately after the ---> END HTTP line.

The issue is so terribly difficult to reproduce that I can't attach the debugger and hope for it to occur on a breakpoint.

@JakeWharton

This comment has been minimized.

Show comment
Hide comment
@JakeWharton

JakeWharton Jan 8, 2015

Collaborator

Jesse and I talked about a Retrofit-like logging system for stupid-easy
things like this. We have to be careful, though, because both headers and
the response body can come from different places. In this case you want the
headers logged before the body is read which is a very, very fine level of
logging.
On Jan 7, 2015 6:49 PM, "Paul Lammertsma" notifications@github.com wrote:

Perhaps it would be useful for logging that the headers are output before
the rest of the response body is attempted to be read? The issue is so
terribly difficult to reproduce that I can't attach the debugger and hope
for it to occur on a breakpoint.


Reply to this email directly or view it on GitHub
#1114 (comment).

Collaborator

JakeWharton commented Jan 8, 2015

Jesse and I talked about a Retrofit-like logging system for stupid-easy
things like this. We have to be careful, though, because both headers and
the response body can come from different places. In this case you want the
headers logged before the body is read which is a very, very fine level of
logging.
On Jan 7, 2015 6:49 PM, "Paul Lammertsma" notifications@github.com wrote:

Perhaps it would be useful for logging that the headers are output before
the rest of the response body is attempted to be read? The issue is so
terribly difficult to reproduce that I can't attach the debugger and hope
for it to occur on a breakpoint.


Reply to this email directly or view it on GitHub
#1114 (comment).

@pflammertsma

This comment has been minimized.

Show comment
Hide comment
@pflammertsma

pflammertsma Jan 8, 2015

Yes, I can imagine, and looking at where those headers are read, it wouldn't be an ideal place to add logging.

I took another look at the stack trace, and if I understand correctly, noticed that it doesn't even get to reading the headers. The exception is thrown from HttpConnection:187, which seems to suggest that the response is a single line. With Jesse's added details in the stack trace, it appears that the response is actually completely empty. No status line, no headers, no body, nothing.

I'll throw together a bash script to test the API using cURL and see if it ever gets empty responses, but it sounds very strange to me.

Yes, I can imagine, and looking at where those headers are read, it wouldn't be an ideal place to add logging.

I took another look at the stack trace, and if I understand correctly, noticed that it doesn't even get to reading the headers. The exception is thrown from HttpConnection:187, which seems to suggest that the response is a single line. With Jesse's added details in the stack trace, it appears that the response is actually completely empty. No status line, no headers, no body, nothing.

I'll throw together a bash script to test the API using cURL and see if it ever gets empty responses, but it sounds very strange to me.

@t-gao

This comment has been minimized.

Show comment
Hide comment
@t-gao

t-gao Jan 22, 2015

Hi, I met this problem every time trying to send an http request. Sure the Android OS of the device I used to test is bizarrely customized, but it's still worth a look.

Device Info:
device: Coolpad 9976A
Android version: 4.4.2
kernel: 3.4.39

Library Info:
gson-2.3.1
okhttp-2.1.0
okhttp-urlconnection-2.1.0
okio-1.0.1
retrofit-1.8.0

t-gao commented Jan 22, 2015

Hi, I met this problem every time trying to send an http request. Sure the Android OS of the device I used to test is bizarrely customized, but it's still worth a look.

Device Info:
device: Coolpad 9976A
Android version: 4.4.2
kernel: 3.4.39

Library Info:
gson-2.3.1
okhttp-2.1.0
okhttp-urlconnection-2.1.0
okio-1.0.1
retrofit-1.8.0

@t-gao

This comment has been minimized.

Show comment
Hide comment
@t-gao

t-gao Jan 22, 2015

An additional informartion:
When I was single-step debugging the code in DDMS, everything worked fine, I got the response correctly, but when I ran the APP, I got the exception.

t-gao commented Jan 22, 2015

An additional informartion:
When I was single-step debugging the code in DDMS, everything worked fine, I got the response correctly, but when I ran the APP, I got the exception.

@michal-luszczuk

This comment has been minimized.

Show comment
Hide comment
@michal-luszczuk

michal-luszczuk Jan 26, 2015

Our users also facing this issue:

Caused by java.io.EOFException
okio.RealBufferedSource.readUtf8LineStrict (RealBufferedSource.java:192)
com.squareup.okhttp.internal.http.HttpConnection.readResponse (HttpConnection.java:187)
com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders (HttpTransport.java:78)
com.squareup.okhttp.internal.http.HttpEngine.readResponse (HttpEngine.java:665)
com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute (HttpURLConnectionImpl.java:429)
com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse (HttpURLConnectionImpl.java:374)
com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode (HttpURLConnectionImpl.java:469)
retrofit.client.UrlConnectionClient.readResponse (UrlConnectionClient.java:73)
retrofit.client.UrlConnectionClient.execute (UrlConnectionClient.java:38)
retrofit.RestAdapter$RestHandler.invokeRequest (RestAdapter.java:321)
retrofit.RestAdapter$RestHandler.invoke (RestAdapter.java:240)

Devices:
Jiayu GF2 (4.2.2)
MyAudio Blade Smartphone
Akai Glory 3
Concorde Smartphone 5005NFC
THL T200

For some users it not work with WiFi connection, while on 3G all is ok.

Our users also facing this issue:

Caused by java.io.EOFException
okio.RealBufferedSource.readUtf8LineStrict (RealBufferedSource.java:192)
com.squareup.okhttp.internal.http.HttpConnection.readResponse (HttpConnection.java:187)
com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders (HttpTransport.java:78)
com.squareup.okhttp.internal.http.HttpEngine.readResponse (HttpEngine.java:665)
com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute (HttpURLConnectionImpl.java:429)
com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse (HttpURLConnectionImpl.java:374)
com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode (HttpURLConnectionImpl.java:469)
retrofit.client.UrlConnectionClient.readResponse (UrlConnectionClient.java:73)
retrofit.client.UrlConnectionClient.execute (UrlConnectionClient.java:38)
retrofit.RestAdapter$RestHandler.invokeRequest (RestAdapter.java:321)
retrofit.RestAdapter$RestHandler.invoke (RestAdapter.java:240)

Devices:
Jiayu GF2 (4.2.2)
MyAudio Blade Smartphone
Akai Glory 3
Concorde Smartphone 5005NFC
THL T200

For some users it not work with WiFi connection, while on 3G all is ok.

@ArthurSav

This comment has been minimized.

Show comment
Hide comment
@ArthurSav

ArthurSav Jan 26, 2015

An update that maybe help others.

I had the same issue for a long time. Since i updated to retrofit v1.9.0, okhttp 2.2.0, urlconnection 2.2.0 i haven't encountered the problem since.

An update that maybe help others.

I had the same issue for a long time. Since i updated to retrofit v1.9.0, okhttp 2.2.0, urlconnection 2.2.0 i haven't encountered the problem since.

@shaw3257

This comment has been minimized.

Show comment
Hide comment
@shaw3257

shaw3257 Jan 27, 2015

I was able to fix this error for me.

Here was my stacktrace before:

01-26 21:50:38.670    2727-2752/com D/Retrofit﹕ java.io.EOFException: \n not found: size=0 content=...
            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
            at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:791)
            at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:90)
            at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:784)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:645)
            at com.squareup.okhttp.Call.getResponse(Call.java:263)
            at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:219)
            at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:192)
            at com.squareup.okhttp.Call.execute(Call.java:79)
            at retrofit.client.OkClient.execute(OkClient.java:53)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
            at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:818)

I noticed one header had a couple of newlines -- Which seemed to be the root problem.

For me specifically, I was encoding newlines with the following line of code:

Base64.encodeToString(bytes, Base64.DEFAULT);

I changed to:

Base64.encodeToString(bytes, Base64.NO_WRAP);

and it worked.

I was able to fix this error for me.

Here was my stacktrace before:

01-26 21:50:38.670    2727-2752/com D/Retrofit﹕ java.io.EOFException: \n not found: size=0 content=...
            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
            at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:791)
            at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:90)
            at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:784)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:645)
            at com.squareup.okhttp.Call.getResponse(Call.java:263)
            at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:219)
            at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:192)
            at com.squareup.okhttp.Call.execute(Call.java:79)
            at retrofit.client.OkClient.execute(OkClient.java:53)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$2.obtainResponse(RestAdapter.java:278)
            at retrofit.CallbackRunnable.run(CallbackRunnable.java:42)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1112)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:587)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:818)

I noticed one header had a couple of newlines -- Which seemed to be the root problem.

For me specifically, I was encoding newlines with the following line of code:

Base64.encodeToString(bytes, Base64.DEFAULT);

I changed to:

Base64.encodeToString(bytes, Base64.NO_WRAP);

and it worked.

@kaciula

This comment has been minimized.

Show comment
Hide comment
@kaciula

kaciula Jan 27, 2015

I am also seeing this exact issue using retrofit 1.9.0, okhttp-urlconnection 2.2.0. I get the same exception every time I use a certain specific API call. The API call is a simple POST with a text/plain file. Is there a workaround for this?

kaciula commented Jan 27, 2015

I am also seeing this exact issue using retrofit 1.9.0, okhttp-urlconnection 2.2.0. I get the same exception every time I use a certain specific API call. The API call is a simple POST with a text/plain file. Is there a workaround for this?

@macbury

This comment has been minimized.

Show comment
Hide comment

macbury commented Feb 4, 2015

👍

@epint

This comment has been minimized.

Show comment
Hide comment
@epint

epint Feb 5, 2015

Hello, we have the same problem. Everything works on cca 3000 devices, but on one we get this error everytime. The device is called JIAYU JY-G2F with Android 4.2.2.

Here is the stacktrace we get:

Caused by: java.io.EOFException: \n not found: size=45 content=32320d0a7b225374616e6a6541706c696b6163696a65223a7b22536966726122...
       at okio.RealBufferedSource.readUtf8LineStrict(SourceFile:200)
       at com.squareup.okhttp.internal.http.HttpConnection$ChunkedSource.readChunkSize(SourceFile:468)
       at com.squareup.okhttp.internal.http.HttpConnection$ChunkedSource.read(SourceFile:450)
       at okio.RealBufferedSource$1.read(SourceFile:298)
       at java.io.InputStream.read(InputStream.java:163)
       at org.springframework.util.FileCopyUtils.copy(SourceFile:111)
       at org.springframework.util.FileCopyUtils.copyToByteArray(SourceFile:164)
       at org.springframework.http.converter.ByteArrayHttpMessageConverter.readInternal(SourceFile:59)
       at org.springframework.http.converter.ByteArrayHttpMessageConverter.readInternal(SourceFile:38)
       at org.springframework.http.converter.AbstractHttpMessageConverter.read(SourceFile:147)
       at org.springframework.web.client.HttpMessageConverterExtractor.extractData(SourceFile:76)
       at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(SourceFile:655)
       at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(SourceFile:641)
       at org.springframework.web.client.RestTemplate.doExecute(SourceFile:484)
       at org.springframework.web.client.RestTemplate.execute(SourceFile:447)
       at org.springframework.web.client.RestTemplate.exchange(SourceFile:422)
       at com.hrc.eb.mobile.android.hibismobile.rest.RestClient.invoke(SourceFile:290)
       at com.hrc.eb.mobile.android.hibismobile.rest.RestClient.get(SourceFile:349)
       at com.hrc.eb.mobile.android.hibismobile.client.StanjeAplikacijeClient$1.call(SourceFile:35)
       at rx.Observable.unsafeSubscribe(SourceFile:7600)
       at rx.internal.operators.OperatorSubscribeOn$1$1.call(SourceFile:62)
       at rx.internal.schedulers.ScheduledAction.run(SourceFile:45)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
       at java.util.concurrent.FutureTask.run(FutureTask.java:234)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
       at java.lang.Thread.run(Thread.java:838)

Not sure if this is the problem, but the content size is actually 34 (hex: 22). If we decode debug content we get:

22 {"StanjeAplikacije":{"Sifra"

Actual body is:
{"StanjeAplikacije":{"Sifra":"0"}}

Not sure, but maybe it's worth to take a look, why debug content size is 45?

Once more, this works on every other device, on specific device it fails everytime. Same thing can be reproduced with Okhttp 2.0.0 and 2.2.0. It works with Apache HTTP client .

And now, complete trace of response, maybe it helps:

=> Send header, 248 bytes (0xf8)
0000: 47 45 54 20 2f 6d 6f 62 69 6c 65 2f 72 65 73 74 GET /mobile/rest
0010: 73 65 63 2f 70 72 65 76 65 72 6a 61 6e 6a 65 2d sec/preverjanje-
0020: 73 74 61 6e 6a 61 2d 61 70 6c 69 6b 61 63 69 6a stanja-aplikacij
0030: 65 3f 6f 73 3d 32 26 74 69 70 5f 6e 61 70 72 61 e?os=2&tip_napra
0040: 76 65 3d 31 26 76 65 72 7a 69 6a 61 3d 31 2e 31 ve=1&verzija=1.1
0050: 2e 30 20 48 54 54 50 2f 31 2e 31 0d 0a 55 73 65 .0 HTTP/1.1..Use
0060: 72 2d 41 67 65 6e 74 3a 20 63 75 72 6c 2f 37 2e r-Agent: curl/7.
0070: 31 31 2e 30 20 28 69 36 38 36 2d 73 75 73 65 2d 11.0 (i686-suse-
0080: 6c 69 6e 75 78 29 20 6c 69 62 63 75 72 6c 2f 37 linux) libcurl/7
0090: 2e 31 31 2e 30 20 4f 70 65 6e 53 53 4c 2f 30 2e .11.0 OpenSSL/0.
00a0: 39 2e 37 64 20 69 70 76 36 20 7a 6c 69 62 2f 31 9.7d ipv6 zlib/1
00b0: 2e 32 2e 31 0d 0a 48 6f 73 74 3a 20 xx xx xx xx .2.1..Host: xxxx
00c0: xx xx xx xx xx xx xx xx xx 0d 0a 50 72 61 67 6d xxxxxxxxx..Pragm
00d0: 61 3a 20 6e 6f 2d 63 61 63 68 65 0d 0a 61 63 63 a: no-cache..acc
00e0: 65 70 74 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f ept:application/
00f0: 6a 73 6f 6e 0d 0a 0d 0a                         json....
<= Recv header, 17 bytes (0x11)
0000: 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010: 0a                                              .
<= Recv header, 108 bytes (0x6c)
0000: 58 2d 50 6f 77 65 72 65 64 2d 42 79 3a 20 53 65 X-Powered-By: Se
0010: 72 76 6c 65 74 2f 33 2e 31 20 4a 53 50 2f 32 2e rvlet/3.1 JSP/2.
0020: 33 20 28 47 6c 61 73 73 46 69 73 68 20 53 65 72 3 (GlassFish Ser
0030: 76 65 72 20 4f 70 65 6e 20 53 6f 75 72 63 65 20 ver Open Source
0040: 45 64 69 74 69 6f 6e 20 20 34 2e 30 20 20 4a 61 Edition  4.0  Ja
0050: 76 61 2f 4f 72 61 63 6c 65 20 43 6f 72 70 6f 72 va/Oracle Corpor
0060: 61 74 69 6f 6e 2f 31 2e 37 29 0d 0a             ation/1.7)..
<= Recv header, 52 bytes (0x34)
0000: 53 65 72 76 65 72 3a 20 47 6c 61 73 73 46 69 73 Server: GlassFis
0010: 68 20 53 65 72 76 65 72 20 4f 70 65 6e 20 53 6f h Server Open So
0020: 75 72 63 65 20 45 64 69 74 69 6f 6e 20 20 34 2e urce Edition  4.
0030: 30 20 0d 0a                                     0 ..
<= Recv header, 49 bytes (0x31)
0000: 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 6e Cache-Control: n
0010: 6f 2d 63 61 63 68 65 2c 20 6e 6f 2d 73 74 6f 72 o-cache, no-stor
0020: 65 2c 20 6e 6f 2d 74 72 61 6e 73 66 6f 72 6d 0d e, no-transform.
0030: 0a                                              .
<= Recv header, 32 bytes (0x20)
0000: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 Content-Type: ap
0010: 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 0d 0a plication/json..
<= Recv header, 37 bytes (0x25)
0000: 44 61 74 65 3a 20 54 68 75 2c 20 30 35 20 46 65 Date: Thu, 05 Fe
0010: 62 20 32 30 31 35 20 30 37 3a 35 34 3a 35 38 20 b 2015 07:54:58
0020: 47 4d 54 0d 0a                                  GMT..
<= Recv header, 28 bytes (0x1c)
0000: 54 72 61 6e 73 66 65 72 2d 45 6e 63 6f 64 69 6e Transfer-Encodin
0010: 67 3a 20 63 68 75 6e 6b 65 64 0d 0a             g: chunked..
<= Recv data, 40 bytes (0x28)
0000: 32 32 0d 0a 7b 22 53 74 61 6e 6a 65 41 70 6c 69 22..{"StanjeApli
0010: 6b 61 63 69 6a 65 22 3a 7b 22 53 69 66 72 61 22 kacije":{"Sifra"
0020: 3a 22 30 22 7d 7d 0d 0a                         :"0"}}..
<= Recv data, 1 bytes (0x1)
0000: 30                                              0
<= Recv data, 4 bytes (0x4)
0000: 0d 0a 0d 0a                                     ....
== Info: Connection #0 left intact

epint commented Feb 5, 2015

Hello, we have the same problem. Everything works on cca 3000 devices, but on one we get this error everytime. The device is called JIAYU JY-G2F with Android 4.2.2.

Here is the stacktrace we get:

Caused by: java.io.EOFException: \n not found: size=45 content=32320d0a7b225374616e6a6541706c696b6163696a65223a7b22536966726122...
       at okio.RealBufferedSource.readUtf8LineStrict(SourceFile:200)
       at com.squareup.okhttp.internal.http.HttpConnection$ChunkedSource.readChunkSize(SourceFile:468)
       at com.squareup.okhttp.internal.http.HttpConnection$ChunkedSource.read(SourceFile:450)
       at okio.RealBufferedSource$1.read(SourceFile:298)
       at java.io.InputStream.read(InputStream.java:163)
       at org.springframework.util.FileCopyUtils.copy(SourceFile:111)
       at org.springframework.util.FileCopyUtils.copyToByteArray(SourceFile:164)
       at org.springframework.http.converter.ByteArrayHttpMessageConverter.readInternal(SourceFile:59)
       at org.springframework.http.converter.ByteArrayHttpMessageConverter.readInternal(SourceFile:38)
       at org.springframework.http.converter.AbstractHttpMessageConverter.read(SourceFile:147)
       at org.springframework.web.client.HttpMessageConverterExtractor.extractData(SourceFile:76)
       at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(SourceFile:655)
       at org.springframework.web.client.RestTemplate$ResponseEntityResponseExtractor.extractData(SourceFile:641)
       at org.springframework.web.client.RestTemplate.doExecute(SourceFile:484)
       at org.springframework.web.client.RestTemplate.execute(SourceFile:447)
       at org.springframework.web.client.RestTemplate.exchange(SourceFile:422)
       at com.hrc.eb.mobile.android.hibismobile.rest.RestClient.invoke(SourceFile:290)
       at com.hrc.eb.mobile.android.hibismobile.rest.RestClient.get(SourceFile:349)
       at com.hrc.eb.mobile.android.hibismobile.client.StanjeAplikacijeClient$1.call(SourceFile:35)
       at rx.Observable.unsafeSubscribe(SourceFile:7600)
       at rx.internal.operators.OperatorSubscribeOn$1$1.call(SourceFile:62)
       at rx.internal.schedulers.ScheduledAction.run(SourceFile:45)
       at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
       at java.util.concurrent.FutureTask.run(FutureTask.java:234)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.access$201(ScheduledThreadPoolExecutor.java:153)
       at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:267)
       at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
       at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
       at java.lang.Thread.run(Thread.java:838)

Not sure if this is the problem, but the content size is actually 34 (hex: 22). If we decode debug content we get:

22 {"StanjeAplikacije":{"Sifra"

Actual body is:
{"StanjeAplikacije":{"Sifra":"0"}}

Not sure, but maybe it's worth to take a look, why debug content size is 45?

Once more, this works on every other device, on specific device it fails everytime. Same thing can be reproduced with Okhttp 2.0.0 and 2.2.0. It works with Apache HTTP client .

And now, complete trace of response, maybe it helps:

=> Send header, 248 bytes (0xf8)
0000: 47 45 54 20 2f 6d 6f 62 69 6c 65 2f 72 65 73 74 GET /mobile/rest
0010: 73 65 63 2f 70 72 65 76 65 72 6a 61 6e 6a 65 2d sec/preverjanje-
0020: 73 74 61 6e 6a 61 2d 61 70 6c 69 6b 61 63 69 6a stanja-aplikacij
0030: 65 3f 6f 73 3d 32 26 74 69 70 5f 6e 61 70 72 61 e?os=2&tip_napra
0040: 76 65 3d 31 26 76 65 72 7a 69 6a 61 3d 31 2e 31 ve=1&verzija=1.1
0050: 2e 30 20 48 54 54 50 2f 31 2e 31 0d 0a 55 73 65 .0 HTTP/1.1..Use
0060: 72 2d 41 67 65 6e 74 3a 20 63 75 72 6c 2f 37 2e r-Agent: curl/7.
0070: 31 31 2e 30 20 28 69 36 38 36 2d 73 75 73 65 2d 11.0 (i686-suse-
0080: 6c 69 6e 75 78 29 20 6c 69 62 63 75 72 6c 2f 37 linux) libcurl/7
0090: 2e 31 31 2e 30 20 4f 70 65 6e 53 53 4c 2f 30 2e .11.0 OpenSSL/0.
00a0: 39 2e 37 64 20 69 70 76 36 20 7a 6c 69 62 2f 31 9.7d ipv6 zlib/1
00b0: 2e 32 2e 31 0d 0a 48 6f 73 74 3a 20 xx xx xx xx .2.1..Host: xxxx
00c0: xx xx xx xx xx xx xx xx xx 0d 0a 50 72 61 67 6d xxxxxxxxx..Pragm
00d0: 61 3a 20 6e 6f 2d 63 61 63 68 65 0d 0a 61 63 63 a: no-cache..acc
00e0: 65 70 74 3a 61 70 70 6c 69 63 61 74 69 6f 6e 2f ept:application/
00f0: 6a 73 6f 6e 0d 0a 0d 0a                         json....
<= Recv header, 17 bytes (0x11)
0000: 48 54 54 50 2f 31 2e 31 20 32 30 30 20 4f 4b 0d HTTP/1.1 200 OK.
0010: 0a                                              .
<= Recv header, 108 bytes (0x6c)
0000: 58 2d 50 6f 77 65 72 65 64 2d 42 79 3a 20 53 65 X-Powered-By: Se
0010: 72 76 6c 65 74 2f 33 2e 31 20 4a 53 50 2f 32 2e rvlet/3.1 JSP/2.
0020: 33 20 28 47 6c 61 73 73 46 69 73 68 20 53 65 72 3 (GlassFish Ser
0030: 76 65 72 20 4f 70 65 6e 20 53 6f 75 72 63 65 20 ver Open Source
0040: 45 64 69 74 69 6f 6e 20 20 34 2e 30 20 20 4a 61 Edition  4.0  Ja
0050: 76 61 2f 4f 72 61 63 6c 65 20 43 6f 72 70 6f 72 va/Oracle Corpor
0060: 61 74 69 6f 6e 2f 31 2e 37 29 0d 0a             ation/1.7)..
<= Recv header, 52 bytes (0x34)
0000: 53 65 72 76 65 72 3a 20 47 6c 61 73 73 46 69 73 Server: GlassFis
0010: 68 20 53 65 72 76 65 72 20 4f 70 65 6e 20 53 6f h Server Open So
0020: 75 72 63 65 20 45 64 69 74 69 6f 6e 20 20 34 2e urce Edition  4.
0030: 30 20 0d 0a                                     0 ..
<= Recv header, 49 bytes (0x31)
0000: 43 61 63 68 65 2d 43 6f 6e 74 72 6f 6c 3a 20 6e Cache-Control: n
0010: 6f 2d 63 61 63 68 65 2c 20 6e 6f 2d 73 74 6f 72 o-cache, no-stor
0020: 65 2c 20 6e 6f 2d 74 72 61 6e 73 66 6f 72 6d 0d e, no-transform.
0030: 0a                                              .
<= Recv header, 32 bytes (0x20)
0000: 43 6f 6e 74 65 6e 74 2d 54 79 70 65 3a 20 61 70 Content-Type: ap
0010: 70 6c 69 63 61 74 69 6f 6e 2f 6a 73 6f 6e 0d 0a plication/json..
<= Recv header, 37 bytes (0x25)
0000: 44 61 74 65 3a 20 54 68 75 2c 20 30 35 20 46 65 Date: Thu, 05 Fe
0010: 62 20 32 30 31 35 20 30 37 3a 35 34 3a 35 38 20 b 2015 07:54:58
0020: 47 4d 54 0d 0a                                  GMT..
<= Recv header, 28 bytes (0x1c)
0000: 54 72 61 6e 73 66 65 72 2d 45 6e 63 6f 64 69 6e Transfer-Encodin
0010: 67 3a 20 63 68 75 6e 6b 65 64 0d 0a             g: chunked..
<= Recv data, 40 bytes (0x28)
0000: 32 32 0d 0a 7b 22 53 74 61 6e 6a 65 41 70 6c 69 22..{"StanjeApli
0010: 6b 61 63 69 6a 65 22 3a 7b 22 53 69 66 72 61 22 kacije":{"Sifra"
0020: 3a 22 30 22 7d 7d 0d 0a                         :"0"}}..
<= Recv data, 1 bytes (0x1)
0000: 30                                              0
<= Recv data, 4 bytes (0x4)
0000: 0d 0a 0d 0a                                     ....
== Info: Connection #0 left intact
@androidmalin

This comment has been minimized.

Show comment
Hide comment
@androidmalin

androidmalin Feb 20, 2015

I think we can try the last version 2.2.0.Then test this issunes

I think we can try the last version 2.2.0.Then test this issunes

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Feb 22, 2015

Member

FYI, calling setRetryOnConnectionFailure(true) may fix this for you.

Member

swankjesse commented Feb 22, 2015

FYI, calling setRetryOnConnectionFailure(true) may fix this for you.

@coreform

This comment has been minimized.

Show comment
Hide comment
@coreform

coreform Mar 4, 2015

I have observed this issue post addition of setRetryOnConnectionFailure(true). Seems to be less often than it was, but still it's manifested.

coreform commented Mar 4, 2015

I have observed this issue post addition of setRetryOnConnectionFailure(true). Seems to be less often than it was, but still it's manifested.

@simtse

This comment has been minimized.

Show comment
Hide comment
@simtse

simtse Mar 4, 2015

Same here when trying setRetryOnConnectionFailure(true). I still get the problem, not sure if it is less often though.

simtse commented Mar 4, 2015

Same here when trying setRetryOnConnectionFailure(true). I still get the problem, not sure if it is less often though.

@luxsyp

This comment has been minimized.

Show comment
Hide comment
@luxsyp

luxsyp Mar 5, 2015

Device : OPO, android Version 4.4.4
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'

Still having the same issue :
java.io.EOFException: \n not found: size=0 content=...
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:791)

Request :

HTTP POST
Dbname: demo
Apikey: 000000000000000
Content-Type: application/json; charset=UTF-8
Content-Length: 112
{"dbname":"demo","sid":"2c463dfb5d648797d248618e2b921bfda5f65ee0","udid":"63d476fdc0cbc07a"}

luxsyp commented Mar 5, 2015

Device : OPO, android Version 4.4.4
compile 'com.google.code.gson:gson:2.2.+'
compile 'com.squareup.okhttp:okhttp:2.2.0'
compile 'com.squareup.okhttp:okhttp-urlconnection:2.2.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'

Still having the same issue :
java.io.EOFException: \n not found: size=0 content=...
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:187)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:791)

Request :

HTTP POST
Dbname: demo
Apikey: 000000000000000
Content-Type: application/json; charset=UTF-8
Content-Length: 112
{"dbname":"demo","sid":"2c463dfb5d648797d248618e2b921bfda5f65ee0","udid":"63d476fdc0cbc07a"}

@coreform

This comment has been minimized.

Show comment
Hide comment
@coreform

coreform Mar 6, 2015

I have found a request/response that will 100% yield this issue using Nexus5 Lollipop emulator (running on HAXM on Windows 7 64bit if that makes any difference).

I was just about to try tampering with the response, so intercepted the request using Burpsuite, and BAM the issue manifested (i.e. without any HTTP response at all):

System.err﹕ retrofit.RetrofitError: \n not found: size=0 content=...

This to me suggests the issue stems from the request, rather than the response. The request is a POST containing empty body (i.e. Content-Length: 0), following is a scrubbed version of the HTTP request:

POST /lala-bleh/rest/yhgmt/woopsie/zomg/AMAGAD HTTP/1.1
Accept: application/json
Authorization: Basic thiswaslegitbeforeiscrubbedit==
Content-Length: 0
Host: abcdef.hijklmnopqrs.tuvwxyandz.com
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/2.2.0

coreform commented Mar 6, 2015

I have found a request/response that will 100% yield this issue using Nexus5 Lollipop emulator (running on HAXM on Windows 7 64bit if that makes any difference).

I was just about to try tampering with the response, so intercepted the request using Burpsuite, and BAM the issue manifested (i.e. without any HTTP response at all):

System.err﹕ retrofit.RetrofitError: \n not found: size=0 content=...

This to me suggests the issue stems from the request, rather than the response. The request is a POST containing empty body (i.e. Content-Length: 0), following is a scrubbed version of the HTTP request:

POST /lala-bleh/rest/yhgmt/woopsie/zomg/AMAGAD HTTP/1.1
Accept: application/json
Authorization: Basic thiswaslegitbeforeiscrubbedit==
Content-Length: 0
Host: abcdef.hijklmnopqrs.tuvwxyandz.com
Connection: Keep-Alive
Accept-Encoding: gzip
User-Agent: okhttp/2.2.0

@coreform

This comment has been minimized.

Show comment
Hide comment
@coreform

coreform Mar 18, 2015

Just to be sure, to be sure, to be sure: Jesse you recently said:

"is there a missing CRLF (0e 0a) between the last header line and the response body?"

0e == Shift Out, while
0d == Carriage Return

OkHttp isn't erroneously looking for '0e 0a' when it should be looking for '0d 0a', is it?

Just to be sure, to be sure, to be sure: Jesse you recently said:

"is there a missing CRLF (0e 0a) between the last header line and the response body?"

0e == Shift Out, while
0d == Carriage Return

OkHttp isn't erroneously looking for '0e 0a' when it should be looking for '0d 0a', is it?

@iceAnson

This comment has been minimized.

Show comment
Hide comment
@iceAnson

iceAnson Mar 18, 2015

@swankjesse

this is my log:

HTTP/1.1 200 OK
Date: Tue, 17 Mar 2015 09:41:25 GMT
Server: nginx/1.4.4
Content-Type: image/png
Content-Length: 12372
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 2592000
Cache-Control: public, max-age=31536000
Content-Disposition: inline; filename="5438e8e45cbe4.png"
Content-Transfer-Encoding: binary
ETag: "Fo36srH0XgSuMch_AL-fTQ5hR-eS"
X-Log: mc.g;IO
X-Reqid: -XoAAIGdAKsti8ET
X-Whom: nb263
X-Qiniu-Zone: 0
Age: 1
X-Via: 1.1 ych59:8104 (Cdn Cache Server V2.0), 1.1 qzh230:0 (Cdn Cache Server V2.0)
Connection: keep-alive

@swankjesse

this is my log:

HTTP/1.1 200 OK
Date: Tue, 17 Mar 2015 09:41:25 GMT
Server: nginx/1.4.4
Content-Type: image/png
Content-Length: 12372
Accept-Ranges: bytes
Access-Control-Allow-Origin: *
Access-Control-Max-Age: 2592000
Cache-Control: public, max-age=31536000
Content-Disposition: inline; filename="5438e8e45cbe4.png"
Content-Transfer-Encoding: binary
ETag: "Fo36srH0XgSuMch_AL-fTQ5hR-eS"
X-Log: mc.g;IO
X-Reqid: -XoAAIGdAKsti8ET
X-Whom: nb263
X-Qiniu-Zone: 0
Age: 1
X-Via: 1.1 ych59:8104 (Cdn Cache Server V2.0), 1.1 qzh230:0 (Cdn Cache Server V2.0)
Connection: keep-alive

@iceAnson

This comment has been minimized.

Show comment
Hide comment
@iceAnson

iceAnson Mar 18, 2015

@swankjesse
it's same with you

@swankjesse
it's same with you

@iceAnson

This comment has been minimized.

Show comment
Hide comment
@iceAnson

iceAnson Mar 18, 2015

@swankjesse
do you need other debug info?

@swankjesse
do you need other debug info?

@iceAnson

This comment has been minimized.

Show comment
Hide comment
@iceAnson

iceAnson Mar 18, 2015

@epint
how do you handle the problem(EOF) ?I happened so long time and make users unconfirtable experience.

@epint
how do you handle the problem(EOF) ?I happened so long time and make users unconfirtable experience.

@iceAnson

This comment has been minimized.

Show comment
Hide comment
@iceAnson

iceAnson Mar 18, 2015

@epint
do you give up the okhttp?or have someother method instead .?

@epint
do you give up the okhttp?or have someother method instead .?

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Mar 18, 2015

Member

@iceAnson can you run the program above and paste the complete hex response please?

Member

swankjesse commented Mar 18, 2015

@iceAnson can you run the program above and paste the complete hex response please?

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Mar 18, 2015

Member

@coreform does this occur on every URL you post to on the impacted N5?

Member

swankjesse commented Mar 18, 2015

@coreform does this occur on every URL you post to on the impacted N5?

@epint

This comment has been minimized.

Show comment
Hide comment
@epint

epint Mar 19, 2015

@iceAnson for now one user is affected and were not handling it with hope that issue will be resolved. Otherwise we have some solutions in mind (i.e. fallback to some other client etc..) but none is implemented.

epint commented Mar 19, 2015

@iceAnson for now one user is affected and were not handling it with hope that issue will be resolved. Otherwise we have some solutions in mind (i.e. fallback to some other client etc..) but none is implemented.

@DanielNovak

This comment has been minimized.

Show comment
Hide comment
@DanielNovak

DanielNovak Mar 19, 2015

This must somehow be caused by the manufacturer modifications, from reading this thread - most of the affected devices are unlicensed chinese production. We are using OkHttp on a banking application and one client contacted the support line and we even managed to get the client with the phone to visit us and test it for 30 minutes (he did not have much time). Not a single http/https request worked through OkHttp on that application. He was using a ZOPO ZP998. It all failed with "java.io.EOFException: \n not found: size=17 content=03007fa861b9d60200000d0a300d0a0d0a...". I wish I had more time to debug.

How is it possible that the same application works on tens of thousands other devices but not on this one? Maybe the manufacturers are modifying the network stream or using some proxy? Or I don't know...

This must somehow be caused by the manufacturer modifications, from reading this thread - most of the affected devices are unlicensed chinese production. We are using OkHttp on a banking application and one client contacted the support line and we even managed to get the client with the phone to visit us and test it for 30 minutes (he did not have much time). Not a single http/https request worked through OkHttp on that application. He was using a ZOPO ZP998. It all failed with "java.io.EOFException: \n not found: size=17 content=03007fa861b9d60200000d0a300d0a0d0a...". I wish I had more time to debug.

How is it possible that the same application works on tens of thousands other devices but not on this one? Maybe the manufacturers are modifying the network stream or using some proxy? Or I don't know...

@epint

This comment has been minimized.

Show comment
Hide comment
@epint

epint Mar 19, 2015

@DanielNovak even if this your point is correct, it has to be fixable in OkHttp since other clients (i.e. DefaultHttpClient) are not affected and http requests are working with same device, application and server.

epint commented Mar 19, 2015

@DanielNovak even if this your point is correct, it has to be fixable in OkHttp since other clients (i.e. DefaultHttpClient) are not affected and http requests are working with same device, application and server.

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Mar 19, 2015

Member

@epint I think your bug in the emulator is different from the other bug. Your Nexus5 emulator gets an EOF on a stream of size 0; everyone else is seeing actually corrupted data in here. Wish I could get my hands on one of the impacted devices.

If any of you could run the code from this comment #1114 (comment) and paste the resulting hex here, that'd be handy.

Member

swankjesse commented Mar 19, 2015

@epint I think your bug in the emulator is different from the other bug. Your Nexus5 emulator gets an EOF on a stream of size 0; everyone else is seeing actually corrupted data in here. Wish I could get my hands on one of the impacted devices.

If any of you could run the code from this comment #1114 (comment) and paste the resulting hex here, that'd be handy.

@epint

This comment has been minimized.

Show comment
Hide comment
@epint

epint Mar 19, 2015

@swankjesse your comment was probably ment for @coreform. We have a problem on real device.

epint commented Mar 19, 2015

@swankjesse your comment was probably ment for @coreform. We have a problem on real device.

@pflammertsma

This comment has been minimized.

Show comment
Hide comment
@pflammertsma

pflammertsma Mar 19, 2015

Jesse, I'm happy to run the test, but in the meantime I'd like to emphasize
that we're seeing the 0-byte issue intermittently on a Moto X 2014, Samsung
Galaxy S3 and LG G2. These just seem to be random devices from our test.

On Thu, Mar 19, 2015, 19:30 epint notifications@github.com wrote:

@swankjesse https://github.com/swankjesse your comment was probably
ment for @coreform https://github.com/coreform. We have a problem on
real device.


Reply to this email directly or view it on GitHub
#1114 (comment).

Jesse, I'm happy to run the test, but in the meantime I'd like to emphasize
that we're seeing the 0-byte issue intermittently on a Moto X 2014, Samsung
Galaxy S3 and LG G2. These just seem to be random devices from our test.

On Thu, Mar 19, 2015, 19:30 epint notifications@github.com wrote:

@swankjesse https://github.com/swankjesse your comment was probably
ment for @coreform https://github.com/coreform. We have a problem on
real device.


Reply to this email directly or view it on GitHub
#1114 (comment).

@swankjesse

This comment has been minimized.

Show comment
Hide comment
@swankjesse

swankjesse Mar 19, 2015

Member

Thanks @pflammertsma. I think there are two distinct problems here. I'm going to close this issue and re-open two issues for each of the two problems.

  • 0-byte responses, issue 1517. My hypothesis is that these are just badly-behaving webservers, or proxy servers or something. In OkHttp 2.3 we're now including more information about the connection when this problem occurs. This happens to normal devices, like your Moto X 2014.
  • corrupt responses, issue 1518. My hypothesis here is that we're doing something to trigger another bug, and ending up with a corrupt buffer of data.

If you have an otherwise-normal, CTS-passing device that is getting corrupt, non-empty responses, then my hypothesis is invalidated & please let me know!

Member

swankjesse commented Mar 19, 2015

Thanks @pflammertsma. I think there are two distinct problems here. I'm going to close this issue and re-open two issues for each of the two problems.

  • 0-byte responses, issue 1517. My hypothesis is that these are just badly-behaving webservers, or proxy servers or something. In OkHttp 2.3 we're now including more information about the connection when this problem occurs. This happens to normal devices, like your Moto X 2014.
  • corrupt responses, issue 1518. My hypothesis here is that we're doing something to trigger another bug, and ending up with a corrupt buffer of data.

If you have an otherwise-normal, CTS-passing device that is getting corrupt, non-empty responses, then my hypothesis is invalidated & please let me know!

@swankjesse swankjesse closed this Mar 19, 2015

@naitikvithlani

This comment has been minimized.

Show comment
Hide comment
@naitikvithlani

naitikvithlani Mar 25, 2015

Any specific reason for this kind of EOF Exception error occurrence (using retrofit) ??? we all know this is issue facing with all, but i want to know exact problem behind this kind of issue.

Any specific reason for this kind of EOF Exception error occurrence (using retrofit) ??? we all know this is issue facing with all, but i want to know exact problem behind this kind of issue.

@duanhongyi

This comment has been minimized.

Show comment
Hide comment
@duanhongyi

duanhongyi Mar 26, 2015

for android 4.2.2 (vivo y17t)

java.io.IOException: unexpected end of stream on Connection{59.46.115.124:11800, proxy=DIRECT@ hostAddress=59.46.115.124 cipherSuite=none protocol=http/1.1} (recycle count=0)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:210)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:830)
at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:95)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:823)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:684)
at com.squareup.okhttp.Call.getResponse(Call.java:272)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:228)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:199)
at com.squareup.okhttp.Call.execute(Call.java:79)
at com.uu.shit.connection.NetToJavaRequest.requestServer(NetToJavaRequest.java:27)
at com.uu.shit.connection.ConnectionTest.doOwnTest(ConnectionTest.java:23)
at com.uu.shit.MainTest.doTest(MainTest.java:71)
at com.uu.shit.ShitActivity$2$1.run(ShitActivity.java:87)
at java.lang.Thread.run(Thread.java:838)
Caused by: java.io.EOFException: \n not found: size=1460 content=446174653a205468752c203236204d617220323031352030343a30333a303120...

for android 4.2.2 (vivo y17t)

java.io.IOException: unexpected end of stream on Connection{59.46.115.124:11800, proxy=DIRECT@ hostAddress=59.46.115.124 cipherSuite=none protocol=http/1.1} (recycle count=0)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:210)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:830)
at com.squareup.okhttp.internal.http.HttpEngine.access$200(HttpEngine.java:95)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:823)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:684)
at com.squareup.okhttp.Call.getResponse(Call.java:272)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:228)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:199)
at com.squareup.okhttp.Call.execute(Call.java:79)
at com.uu.shit.connection.NetToJavaRequest.requestServer(NetToJavaRequest.java:27)
at com.uu.shit.connection.ConnectionTest.doOwnTest(ConnectionTest.java:23)
at com.uu.shit.MainTest.doTest(MainTest.java:71)
at com.uu.shit.ShitActivity$2$1.run(ShitActivity.java:87)
at java.lang.Thread.run(Thread.java:838)
Caused by: java.io.EOFException: \n not found: size=1460 content=446174653a205468752c203236204d617220323031352030343a30333a303120...

@yq76034150

This comment has been minimized.

Show comment
Hide comment
@yq76034150

yq76034150 Mar 31, 2015

apacheclient no problem,but use okhttp have this problem,log detail:

03-31 13:29:27.055: I/RetrofitCallback(3661): error.toString() :retrofit.RetrofitError: unexpected end of stream on Connection{:18083, proxy=DIRECT@ hostAddress=*** cipherSuite=none protocol=http/1.1} (recycle count=0)
03-31 13:29:45.255: I/RetrofitCallback(3661): error.getUrl() :http://****** error msg :unexpected end of stream on Connection{
:18083, proxy=DIRECT@ hostAddress=*** cipherSuite=none protocol=http/1.1} (recycle count=0)

apacheclient no problem,but use okhttp have this problem,log detail:

03-31 13:29:27.055: I/RetrofitCallback(3661): error.toString() :retrofit.RetrofitError: unexpected end of stream on Connection{:18083, proxy=DIRECT@ hostAddress=*** cipherSuite=none protocol=http/1.1} (recycle count=0)
03-31 13:29:45.255: I/RetrofitCallback(3661): error.getUrl() :http://****** error msg :unexpected end of stream on Connection{
:18083, proxy=DIRECT@ hostAddress=*** cipherSuite=none protocol=http/1.1} (recycle count=0)

@christophesmet

This comment has been minimized.

Show comment
Hide comment
@christophesmet

christophesmet Apr 19, 2015

I had the same issue and solved it.
I also got Caused by: java.io.EOFException: \n not found:

After closer inspection I notices that after the status code, the server didn't gave a description.
Example:
HTTP/1.1 500 Internal server error
Content-Type: text/xml; charset=utf-8

But this is broken:
HTTP/1.1 500
Content-Type: text/xml; charset=utf-8

So in my example the (somewhat exotic) http server didn't return a reason after the status code.
RFC2616 defines a reason after the status, so in my case it's not a fault of the library.
But I thought I might mention it, it might help someone.

I had the same issue and solved it.
I also got Caused by: java.io.EOFException: \n not found:

After closer inspection I notices that after the status code, the server didn't gave a description.
Example:
HTTP/1.1 500 Internal server error
Content-Type: text/xml; charset=utf-8

But this is broken:
HTTP/1.1 500
Content-Type: text/xml; charset=utf-8

So in my example the (somewhat exotic) http server didn't return a reason after the status code.
RFC2616 defines a reason after the status, so in my case it's not a fault of the library.
But I thought I might mention it, it might help someone.

@duanhongyi

This comment has been minimized.

Show comment
Hide comment
@duanhongyi

duanhongyi Apr 20, 2015

@christophesmet

Disable jit:
android:vmSafeMode="true"

see this:
#1518

@christophesmet

Disable jit:
android:vmSafeMode="true"

see this:
#1518

@harmanjassal

This comment has been minimized.

Show comment
Hide comment
@harmanjassal

harmanjassal May 8, 2015

Got the same error in our prod environment. I have validated the health of Load balancer and instnace and both seem to be working fine.

Caused by: java.io.EOFException
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:154)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:189)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:676)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:426)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:371)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:466)
at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
... 18 more

Got the same error in our prod environment. I have validated the health of Load balancer and instnace and both seem to be working fine.

Caused by: java.io.EOFException
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:154)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:189)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:101)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:676)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:426)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:371)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:466)
at retrofit.client.UrlConnectionClient.readResponse(UrlConnectionClient.java:73)
at retrofit.client.UrlConnectionClient.execute(UrlConnectionClient.java:38)
at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:321)
... 18 more

@DanDevine

This comment has been minimized.

Show comment
Hide comment
@DanDevine

DanDevine May 19, 2015

Currently getting the dreaded EOFException.

Running:
Samsung Galaxy Nexus
Android version 4.3

Project dependency:
compile 'com.squareup.retrofit:retrofit:1.9.0'

Adapter configuration:
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(host)
.setRequestInterceptor(interceptor)
.setLogLevel(RestAdapter.LogLevel.FULL)
.setConverter( new GsonConverter(gson))
.build();

Thanks, listening for updates.

Currently getting the dreaded EOFException.

Running:
Samsung Galaxy Nexus
Android version 4.3

Project dependency:
compile 'com.squareup.retrofit:retrofit:1.9.0'

Adapter configuration:
RestAdapter adapter = new RestAdapter.Builder()
.setEndpoint(host)
.setRequestInterceptor(interceptor)
.setLogLevel(RestAdapter.LogLevel.FULL)
.setConverter( new GsonConverter(gson))
.build();

Thanks, listening for updates.

@JixunMoe

This comment has been minimized.

Show comment
Hide comment
@JixunMoe

JixunMoe Jul 24, 2015

Maybe malformed/different version gzip reply from server(?)

    public static void main(String[] args) {
        final OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
                .url("http://sosu.qidian.com/ajax/search.ashx?method=Search&keyword=TEST")
                .addHeader("Referer", "http://sosu.qidian.com/")
                .build();

        Response response = null;
        String res = null;
        try {
            response = client.newCall(request).execute();
            res = response.body().string();
        } catch (IOException e) {
            e.printStackTrace();
        }

        if (response != null && res != null)
            System.out.println(res);
    }

By adding .addHeader("Accept-Encoding", "none") to above code I'm able to get the data I wanted. But the aim for me is to save the bandwidth, so this is only used as a temporary workaround.

To check if is header dependent error, I have also test with curl using same headers, and the result has been properly replied.

curl "http://sosu.qidian.com/ajax/search.ashx?method=Search&keyword=DD" -H "Accept: */*" -H "Referer: http://sosu.qidian.com/" -H "Connection: keep-alive" -H "Accept-Encoding: gzip" -H "User-Agent: okhttp/2.4.0" --compressed

GET /ajax/search.ashx?method=Search&keyword=DD HTTP/1.1
> Host: sosu.qidian.com
> Accept: */*
> Referer: http://sosu.qidian.com/
> Connection: keep-alive
> Accept-Encoding: gzip
> User-Agent: okhttp/2.4.0
>
< HTTP/1.1 200 OK
< Date: Fri, 24 Jul 2015 22:09:55 GMT
< Server: Microsoft-IIS/6.0
< X-Powered-By: ASP.NET
< X-AspNet-Version: 2.0.50727
< Set-Cookie: ASP.NET_SessionId=*hidden*; domain=.qidian.com; path=/; HttpOnly
< Set-Cookie: sosu_abtest=; expires=Thu, 23-Jul-2015 22:10:04 GMT; path=/
< Cache-Control: private
< Content-Type: text/plain; charset=utf-8
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< X-Via: 1.1 czdx84:8107 (Cdn Cache Server V2.0), 1.1 ld15:6 (Cdn Cache Server V2.0)
< Connection: keep-alive
<
{ [5096 bytes data]

I've also created chunked gzip response using Apache and php, which okhttp had no problem:

=== BEGIN ===

<?php sleep(1);
for ($i = 0; $i < 80000; $i++) {
    echo mt_rand();
}
sleep(1);    ?>

=== END ===

.htaccess: SetOutputFilter DEFLATE

Maybe malformed/different version gzip reply from server(?)

    public static void main(String[] args) {
        final OkHttpClient client = new OkHttpClient();
        Request request = new Request.Builder()
                .url("http://sosu.qidian.com/ajax/search.ashx?method=Search&keyword=TEST")
                .addHeader("Referer", "http://sosu.qidian.com/")
                .build();

        Response response = null;
        String res = null;
        try {
            response = client.newCall(request).execute();
            res = response.body().string();
        } catch (IOException e) {
            e.printStackTrace();
        }

        if (response != null && res != null)
            System.out.println(res);
    }

By adding .addHeader("Accept-Encoding", "none") to above code I'm able to get the data I wanted. But the aim for me is to save the bandwidth, so this is only used as a temporary workaround.

To check if is header dependent error, I have also test with curl using same headers, and the result has been properly replied.

curl "http://sosu.qidian.com/ajax/search.ashx?method=Search&keyword=DD" -H "Accept: */*" -H "Referer: http://sosu.qidian.com/" -H "Connection: keep-alive" -H "Accept-Encoding: gzip" -H "User-Agent: okhttp/2.4.0" --compressed

GET /ajax/search.ashx?method=Search&keyword=DD HTTP/1.1
> Host: sosu.qidian.com
> Accept: */*
> Referer: http://sosu.qidian.com/
> Connection: keep-alive
> Accept-Encoding: gzip
> User-Agent: okhttp/2.4.0
>
< HTTP/1.1 200 OK
< Date: Fri, 24 Jul 2015 22:09:55 GMT
< Server: Microsoft-IIS/6.0
< X-Powered-By: ASP.NET
< X-AspNet-Version: 2.0.50727
< Set-Cookie: ASP.NET_SessionId=*hidden*; domain=.qidian.com; path=/; HttpOnly
< Set-Cookie: sosu_abtest=; expires=Thu, 23-Jul-2015 22:10:04 GMT; path=/
< Cache-Control: private
< Content-Type: text/plain; charset=utf-8
< Content-Encoding: gzip
< Transfer-Encoding: chunked
< X-Via: 1.1 czdx84:8107 (Cdn Cache Server V2.0), 1.1 ld15:6 (Cdn Cache Server V2.0)
< Connection: keep-alive
<
{ [5096 bytes data]

I've also created chunked gzip response using Apache and php, which okhttp had no problem:

=== BEGIN ===

<?php sleep(1);
for ($i = 0; $i < 80000; $i++) {
    echo mt_rand();
}
sleep(1);    ?>

=== END ===

.htaccess: SetOutputFilter DEFLATE

@christophesmet

This comment has been minimized.

Show comment
Hide comment
@christophesmet

christophesmet Jul 28, 2015

An ssl issue caused the no response bug with me.
For some reason, the error isn't show in the sslsocketfactory.
But doing the same call in python does show an ssl error.

An ssl issue caused the no response bug with me.
For some reason, the error isn't show in the sslsocketfactory.
But doing the same call in python does show an ssl error.

@zourb

This comment has been minimized.

Show comment
Hide comment
@zourb

zourb Jul 30, 2015

Got the same error

java.io.IOException: unexpected end of stream on Connection{p33.qhimg.com:80, proxy=DIRECT@ hostAddress=42.81.9.47 cipherSuite=none protocol=http/1.1} (recycle count=1)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:211)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:95)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:902)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:760)
at com.squareup.okhttp.Call.getResponse(Call.java:274)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
at com.squareup.okhttp.Call.execute(Call.java:81)
Caused by: java.io.EOFException: \n not found: size=0 content=...
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191)
... 17 more

zourb commented Jul 30, 2015

Got the same error

java.io.IOException: unexpected end of stream on Connection{p33.qhimg.com:80, proxy=DIRECT@ hostAddress=42.81.9.47 cipherSuite=none protocol=http/1.1} (recycle count=1)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:211)
at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:95)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:902)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:760)
at com.squareup.okhttp.Call.getResponse(Call.java:274)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
at com.squareup.okhttp.Call.execute(Call.java:81)
Caused by: java.io.EOFException: \n not found: size=0 content=...
at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:191)
... 17 more

@ihgoo

This comment has been minimized.

Show comment
Hide comment
@ihgoo

ihgoo Aug 1, 2015

OKHttp 2.4 doesn't work on some HUAWEI devices ..

eg: for android 4.2.2 (HUAWEI Y518-T00) wifi and 3G

compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'

Currently getting the dreaded EOFException:like this

2261-3324/com.bqs.wetime.fruits D/Retrofit﹕ java.io.IOException: unexpected end of stream on Connection{192.168.1.208:8080, proxy=DIRECT@ hostAddress=192.168.1.208 cipherSuite=none protocol=http/1.1} (recycle count=0)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:211)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
            at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
            at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:95)
            at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:902)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:760)
            at com.squareup.okhttp.Call.getResponse(Call.java:274)
            at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
            at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
            at com.squareup.okhttp.Call.execute(Call.java:81)
            at retrofit.client.OkClient.execute(OkClient.java:53)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$1.invoke(RestAdapter.java:265)
            at retrofit.RxSupport$2.run(RxSupport.java:55)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:838)
     Caused by: java.io.EOFException: \n not found: size=9539 content=096f72672e737072696e676672616d65776f726b2e6a6462632e64617461736f...
            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
            at com.squareup.okhttp.internal.http.HttpConnection.readHeaders(HttpConnection.java:220)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:199)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
            at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
            at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:95)
            at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:902)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:760)
            at com.squareup.okhttp.Call.getResponse(Call.java:274)
            at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
            at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
            at com.squareup.okhttp.Call.execute(Call.java:81)
            at retrofit.client.OkClient.execute(OkClient.java:53)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$1.invoke(RestAdapter.java:265)
            at retrofit.RxSupport$2.run(RxSupport.java:55)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:838)

ihgoo commented Aug 1, 2015

OKHttp 2.4 doesn't work on some HUAWEI devices ..

eg: for android 4.2.2 (HUAWEI Y518-T00) wifi and 3G

compile 'com.squareup.okhttp:okhttp:2.4.0'
compile 'com.squareup.retrofit:retrofit:1.9.0'

Currently getting the dreaded EOFException:like this

2261-3324/com.bqs.wetime.fruits D/Retrofit﹕ java.io.IOException: unexpected end of stream on Connection{192.168.1.208:8080, proxy=DIRECT@ hostAddress=192.168.1.208 cipherSuite=none protocol=http/1.1} (recycle count=0)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:211)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
            at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
            at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:95)
            at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:902)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:760)
            at com.squareup.okhttp.Call.getResponse(Call.java:274)
            at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
            at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
            at com.squareup.okhttp.Call.execute(Call.java:81)
            at retrofit.client.OkClient.execute(OkClient.java:53)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$1.invoke(RestAdapter.java:265)
            at retrofit.RxSupport$2.run(RxSupport.java:55)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:838)
     Caused by: java.io.EOFException: \n not found: size=9539 content=096f72672e737072696e676672616d65776f726b2e6a6462632e64617461736f...
            at okio.RealBufferedSource.readUtf8LineStrict(RealBufferedSource.java:200)
            at com.squareup.okhttp.internal.http.HttpConnection.readHeaders(HttpConnection.java:220)
            at com.squareup.okhttp.internal.http.HttpConnection.readResponse(HttpConnection.java:199)
            at com.squareup.okhttp.internal.http.HttpTransport.readResponseHeaders(HttpTransport.java:80)
            at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:917)
            at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:95)
            at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:902)
            at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:760)
            at com.squareup.okhttp.Call.getResponse(Call.java:274)
            at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:230)
            at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:201)
            at com.squareup.okhttp.Call.execute(Call.java:81)
            at retrofit.client.OkClient.execute(OkClient.java:53)
            at retrofit.RestAdapter$RestHandler.invokeRequest(RestAdapter.java:326)
            at retrofit.RestAdapter$RestHandler.access$100(RestAdapter.java:220)
            at retrofit.RestAdapter$RestHandler$1.invoke(RestAdapter.java:265)
            at retrofit.RxSupport$2.run(RxSupport.java:55)
            at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:390)
            at java.util.concurrent.FutureTask.run(FutureTask.java:234)
            at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1080)
            at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:573)
            at retrofit.Platform$Android$2$1.run(Platform.java:142)
            at java.lang.Thread.run(Thread.java:838)
@krawa

This comment has been minimized.

Show comment
Hide comment
@krawa

krawa Aug 11, 2015

Got the same error
ANDROID_VERSION=4.2.2
PHONE_MODEL=Quest 507

okhttp-2.4.0
okhttp-urlconnection-2.4.0
okio-1.4.0

krawa commented Aug 11, 2015

Got the same error
ANDROID_VERSION=4.2.2
PHONE_MODEL=Quest 507

okhttp-2.4.0
okhttp-urlconnection-2.4.0
okio-1.4.0

@krawa

This comment has been minimized.

Show comment
Hide comment
@krawa

krawa Aug 11, 2015

added android:vmSafeMode="true" and problem is gone!

krawa commented Aug 11, 2015

added android:vmSafeMode="true" and problem is gone!

@robfletcher

This comment has been minimized.

Show comment
Hide comment
@robfletcher

robfletcher Jan 11, 2016

I'm getting this from a server app where we're using OkHttp 2.2.0 under Retrofit. I'm making an HTTPS POST request to a slow-responding service and it ends up getting retried because this exception is thrown. The retry is causing us problems because the request isn't idempotent. If I set OkHttp's readTimeout lower it stops happening because the read times out before this exception is thrown.

Please let me know if I can help debugging.

I'm getting this from a server app where we're using OkHttp 2.2.0 under Retrofit. I'm making an HTTPS POST request to a slow-responding service and it ends up getting retried because this exception is thrown. The retry is causing us problems because the request isn't idempotent. If I set OkHttp's readTimeout lower it stops happening because the read times out before this exception is thrown.

Please let me know if I can help debugging.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment