Reputation: 681
I am using retrofit-beta2 and i get the below crash from time to time. Am not sure what am i doing wrong. It would be great if someone could give me a hint on fixing the problem.
Fatal Exception: java.util.NoSuchElementException
at com.squareup.okhttp.internal.http.RouteSelector.next(RouteSelector.java:79)
at com.squareup.okhttp.internal.http.StreamAllocation.findConnection(StreamAllocation.java:164)
at com.squareup.okhttp.internal.http.StreamAllocation.findHealthyConnection(StreamAllocation.java:126)
at com.squareup.okhttp.internal.http.StreamAllocation.newStream(StreamAllocation.java:95)
at com.squareup.okhttp.internal.http.HttpEngine.connect(HttpEngine.java:283)
at com.squareup.okhttp.internal.http.HttpEngine.sendRequest(HttpEngine.java:224)
at com.squareup.okhttp.Call.getResponse(Call.java:286)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:243)
at com.squareup.okhttp.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:204)
at com.squareup.okhttp.Call$ApplicationInterceptorChain.proceed(Call.java:232)
at com.squareup.okhttp.Call.getResponseWithInterceptorChain(Call.java:205)
at com.squareup.okhttp.Call.access$100(Call.java:35)
at com.squareup.okhttp.Call$AsyncCall.execute(Call.java:171)
at com.squareup.okhttp.internal.NamedRunnable.run(NamedRunnable.java:33)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1113)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:588)
at java.lang.Thread.run(Thread.java:818)
Upvotes: 2
Views: 2405
Reputation: 41
As said in this issue there is two possibilities:
OkHttp has a bug where we’re attempting to recover when we shouldn't be because we’ve exhausted all of the available routes.
OkHttp has a bug where you’ve got a custom DNS implementation that returned zero IP addresses for a host and we didn't reject that.
My suggestion is to use new versions of retrofit and okhttp, because Retrofit 2 is already in release.
compile 'com.squareup.okhttp3:okhttp:3.1.2'
compile 'com.squareup.retrofit2:retrofit:2.0.0'
Upvotes: 1