Hi,
I'm using retrofit and seen found the error _java.io.IOException: stream was reset: PROTOCOL_ERROR_ when connecting to:
https://docs.google.com/a/google.com/spreadsheets/d/1TLV0JH_DJVb5KRQf56I_Cv6oZY-jHl6bYAIQ9QuBisk/export?gid=0&format=csv
Stacktrace:
java.io.IOException: stream was reset: PROTOCOL_ERROR
at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:146)
at com.squareup.okhttp.internal.http.FramedTransport.readResponseHeaders(FramedTransport.java:104)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:906)
at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:92)
at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:891)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:749)
at com.squareup.okhttp.Call.getResponse(Call.java:268)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:224)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195)
at com.squareup.okhttp.Call.execute(Call.java:79)
at retrofit.OkHttpCall.execute(OkHttpCall.java:112)
at retrofit.ExecutorCallAdapterFactory$ExecutorCallbackCall.execute(ExecutorCallAdapterFactory.java:59)
at (...)
This issue points to the same problem but was closed due to lack of information https://github.com/square/okhttp/issues/1195
Seems to work now. I just updated retorfit to 2.0.0-beta2
I ran into this issue just now on 2.5.0. would you mind sharing your fix? In my case it's wordpress public rest API giving the error.
I'm seeing the same error in a few of my apps. Started kinda randomly. Tried okhttp v2.4 & v2.5
P.S this is the url it fails to load
Failed to load image: https://mpgirrrl.files.wordpress.com/2011/04/paul_02.png
I have the same problem.
Wordpress must have updated some things. It works correctly in the browser but fails to load with okhttp 2.4 and 2.5
I made no updates and it stopped working a few days ago.
to reproduce:
HttpUrl url = HttpUrl.parse("https://public-api.wordpress.com/rest/v1.1/sites/crossroad247.com/posts/?number=5&fields=ID,title,content,featured_image,date,URL&meta_key=_thumbnail_id&modified_after=2015-09-13T18:15:53");
Request request = new Request.Builder().url(url).build();
new OkHttpClient().newCall(request).execute().body().string();
W: java.io.IOException: stream was reset: PROTOCOL_ERROR
W: at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:146)
W: at com.squareup.okhttp.internal.http.FramedTransport.readResponseHeaders(FramedTransport.java:104)
W: at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:906)
W: at com.squareup.okhttp.internal.http.HttpEngine.access$300(HttpEngine.java:92)
W: at com.squareup.okhttp.internal.http.HttpEngine$NetworkInterceptorChain.proceed(HttpEngine.java:891)
W: at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:749)
W: at com.squareup.okhttp.Call.getResponse(Call.java:268)
W: at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:224)
W: at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:195)
W: at com.squareup.okhttp.Call.execute(Call.java:79)
I worked around this (for WordPress at least) y forcing http1.1
I first saw this on okhttp 2.4.0. On that version the exception mentioned SPDY. For what it's worth, I am also making requests to a wordpress site (gravatar).
The exception changed to the above (@jedrivisser's) in 2.5.0.
The 2.4.0 exception:
java.io.IOException: stream was reset: PROTOCOL_ERROR
at com.squareup.okhttp.internal.spdy.SpdyStream.getResponseHeaders(SpdyStream.java:145)
at com.squareup.okhttp.internal.http.SpdyTransport.readResponseHeaders(SpdyTransport.java:104)
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)
@mateuyabar could you clarify what version fixed this? 2.0.0-beta2 sounds like a Retrofit version number (released recently).
I see now this ticket is actually closed.
There seems to be a new ticket:
https://github.com/square/okhttp/issues/1897
@dpkirchner I just updated Retrofit and its working now. It may be some change on the site itself, but now I don't see the error any more.
@mateuyabar This is not just a retrofit issue.
I'm using picasso and get the same error.
All these libs use okHttp to make network calls...
Can you reopen the issue, it's not fixed.
I get the same exception when I open http2 of my nginx server.
10-07 16:49:12.555 11473-11473/com.diyidan E/Volley﹕ java.io.IOException: stream was reset: PROTOCOL_ERROR
com.android.volley.NoConnectionError: java.io.IOException: stream was reset: PROTOCOL_ERROR
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:166)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
Caused by: java.io.IOException: stream was reset: PROTOCOL_ERROR
at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:146)
at com.squareup.okhttp.internal.http.FramedTransport.readResponseHeaders(FramedTransport.java:104)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:906)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:782)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:444)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:389)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:502)
at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:110)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:98)
            at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
10-07 16:49:12.555 11473-11473/com.diyidan E/Volley﹕ java.io.IOException: stream was reset: PROTOCOL_ERROR
com.android.volley.NoConnectionError: java.io.IOException: stream was reset: PROTOCOL_ERROR
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:166)
at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
Caused by: java.io.IOException: stream was reset: PROTOCOL_ERROR
at com.squareup.okhttp.internal.framed.FramedStream.getResponseHeaders(FramedStream.java:146)
at com.squareup.okhttp.internal.http.FramedTransport.readResponseHeaders(FramedTransport.java:104)
at com.squareup.okhttp.internal.http.HttpEngine.readNetworkResponse(HttpEngine.java:906)
at com.squareup.okhttp.internal.http.HttpEngine.readResponse(HttpEngine.java:782)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.execute(HttpURLConnectionImpl.java:444)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponse(HttpURLConnectionImpl.java:389)
at com.squareup.okhttp.internal.huc.HttpURLConnectionImpl.getResponseCode(HttpURLConnectionImpl.java:502)
at com.squareup.okhttp.internal.huc.DelegatingHttpsURLConnection.getResponseCode(DelegatingHttpsURLConnection.java:105)
at com.squareup.okhttp.internal.huc.HttpsURLConnectionImpl.getResponseCode(HttpsURLConnectionImpl.java:25)
at com.android.volley.toolbox.HurlStack.performRequest(HurlStack.java:110)
at com.android.volley.toolbox.BasicNetwork.performRequest(BasicNetwork.java:98)
            at com.android.volley.NetworkDispatcher.run(NetworkDispatcher.java:114)
@swankjesse @JakeWharton
Any ideas on this one? Suddenly(no updates or anything unsual) some images won't load due to that error.
Using okhttp & picasso with a 5.1.1 Note 4
I found the error happen when for the server is nginx 1.9.5 with http2.
When I connect to google.com, it's all ok.
It's a bug in NGINX 1.9.5. Please upgrade your NGINX!
https://github.com/square/okhttp/issues/1897
I'm seeing the error again.
I'm getting the error when downloading an cvs from Googledocs, so I don't think it is related to NGINX version.
Please report a separate issue with a failing test case. CallTest is a good place to start.
I am seeing a similar issue with google OAuth server. Opening new issue as suggested (https://github.com/square/okhttp/issues/2204)
I was seeing this error with okhttp v3.11.0. My issue was caused by me not specifying a correct API key required by our servers.
Most helpful comment
I worked around this (for WordPress at least) y forcing http1.1