java.io.IOException: unexpected end of stream on okhttp3.Address@###
See original GitHub issue#2147 - in previous version there was also this issue and was apparently not resolved
While I am trying to connect to one of webservices used in my app on first attempt I get mentioned in title error, then after retry I got correct data. My configuration of okHttpClient:
@Provides
@Singleton
HttpLoggingInterceptor providesHttpLoggingInterceptor() {
HttpLoggingInterceptor interceptor = new HttpLoggingInterceptor();
interceptor.setLevel(HttpLoggingInterceptor.Level.BODY);
return interceptor;
}
@Provides
@Singleton
StethoInterceptor providesStethoInterceptor(){
return new StethoInterceptor();
}
@Provides
@Singleton
OkHttpClient providesOKClient(HttpLoggingInterceptor interceptor, StethoInterceptor stethoInterceptor) {
return new OkHttpClient.Builder()
.addInterceptor(interceptor)
.addNetworkInterceptor(stethoInterceptor)
.retryOnConnectionFailure(true)
.connectTimeout(15, TimeUnit.SECONDS)
.readTimeout(20, TimeUnit.SECONDS)
.build();
}
In the attachment there is screenshot from Stetho showing the situation and addreses I try to connect with.
Calls are made with Retrofit 2 - beta4 using Call asynchronous.
There is no rule when issue is occuring down, so I only leave it here.
Issue Analytics
- State:
- Created 8 years ago
- Comments:14 (2 by maintainers)
Top Results From Across the Web
IOException: unexpected end of stream on okhttp3.Address ...
The error occurs when OkHttp try to reuse a connection that is in FIN_WAIT2 state in server, because the server keep_alive timeout is...
Read more >Android OkHttp HTTP FAILED: java.io.IOException
I/okhttp.OkHttpClient: <-- HTTP FAILED: java.io.IOException: unexpected end of stream on http://10.0.2.2:30000/... java.io.
Read more >unexpected end of stream on com.android.okhttp.Address ...
and this is the error: Java.IO.IOException: unexpected end of stream on com.android.okhttp.Address@403f40ec ---> Java.IO.
Read more >unexpected end of stream on okhttp3.Address@2c98c95e - B4X
Hi all, today I'm encountering this error message while connecting to my VPS where a B4J module is listening in order to serve...
Read more >IOException unexpected end of stream when listing locations ...
It appears that okhttp3 is falling over on itself inside the API. If I resend the request it tends to then go through...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@dimsuz our nginx cached large responses into local folder
/tmp/cache/nginx/some-cache-folder
. Thissome-cache-folder
has incorrect access rights and nginx close connectiond immediatly, when ended its inner buffer, without save responses into folder. So magic trick)Got the same error. Turns out turning off BODY logging fixed it for us.
interceptor.setLevel(HttpLoggingInterceptor.Level.NONE);