0

Within an Android app, I'm using a combination of

RxJava: 1.3.0 retrorit: 2.3.0 okHttp: 3.9.0

There are a fair amount of REST parallel calls going on, but I'm seeing a seeming random InterruptedIOException when calling the proceed chain of a interceptor that just adds a few auth headers. The problem I'm having is I get no context from the exception so I can't figure out the cause, it is not a timeout I don't think since no matter how high I set the the error seems to happen quickly. Is it possible the call is being cancelled and this is how unsubscribing presents itself?

What I need to know is what are the likely causes of this InterruptedIOException so I can figure out. Here is a bit of context within the exception tree.

Thanks.

ZubieRetrofit: --> GET https://blah/blah/blah
ZubieRetrofit: User-Agent: qa 1.20.0
ZubieRetrofit: Authorization: Bearer xxxxx
ZubieRetrofit: Zubie-Identity-Provider: fred
ZubieRetrofit: Zubie-Account-Id: yyyyy
ZubieRetrofit: --> END GET
ZubieRetrofit: <-- HTTP FAILED: java.io.InterruptedIOException
ZubieRetrofit$ZubieCall: Exception thrown in ZubieCallInterceptor.intercept
java.io.InterruptedIOException
at okhttp3.internal.http2.Http2Stream.waitForIo(Http2Stream.java:579)
at okhttp3.internal.http2.Http2Stream.takeResponseHeaders(Http2Stream.java:143)
at okhttp3.internal.http2.Http2Codec.readResponseHeaders(Http2Codec.java:125)
at okhttp3.internal.http.CallServerInterceptor.intercept(CallServerInterceptor.java:88)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.connection.ConnectInterceptor.intercept(ConnectInterceptor.java:45)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.cache.CacheInterceptor.intercept(CacheInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.internal.http.BridgeInterceptor.intercept(BridgeInterceptor.java:93)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:125)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.logging.HttpLoggingInterceptor.intercept(HttpLoggingInterceptor.java:212)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at com.greenlight.zubie.network.ZubieRetrofit$ZubieCallInterceptor.intercept(ZubieRetrofit.java:1378)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:147)
at okhttp3.internal.http.RealInterceptorChain.proceed(RealInterceptorChain.java:121)
at okhttp3.RealCall.getResponseWithInterceptorChain(RealCall.java:200)
at okhttp3.RealCall.execute(RealCall.java:77)
at retrofit2.OkHttpCall.execute(OkHttpCall.java:180)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:40)
at retrofit2.adapter.rxjava.CallExecuteOnSubscribe.call(CallExecuteOnSubscribe.java:24)
at rx.internal.operators.OnSubscribeOnAssembly.call(OnSubscribeOnAssembly.java:96)
at rx.internal.operators.OnSubscribeOnAssembly.call(OnSubscribeOnAssembly.java:29)
at rx.Observable.unsafeSubscribe(Observable.java:10256)
at rx.internal.operators.OperatorSubscribeOn$SubscribeOnSubscriber.call(OperatorSubscribeOn.java:100)
at rx.internal.schedulers.CachedThreadScheduler$EventLoopWorker$1.call(CachedThreadScheduler.java:230)
at rx.internal.schedulers.ScheduledAction.run(ScheduledAction.java:55)
at java.util.concurrent.Executors$RunnableAdapter.call(Executors.java:457)
at java.util.concurrent.FutureTask.run(FutureTask.java:266)
at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:301)
at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1162)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:636)
at java.lang.Thread.run(Thread.java:764)
Kenny
  • 805
  • 8
  • 19
  • What is this `ZubieCallInterceptor` it shows you're using? – em_ Oct 10 '17 at 17:06
  • Finally figured out the issue. It's how the cancel appears when a subscription is unsubscribed when active. Just couldn't tell from the stack trace. – Kenny Nov 13 '17 at 15:34
  • How did you fix it? I have the same issue and am using disposables. How should I unsubscribe? – dazza5000 Feb 24 '18 at 04:24

1 Answers1

0

Adding custom global error consumer helped me to fix similar issue as it looks like okhttp nor retrofit2-rxjava2-adapter do not process call cancelling in safe way in terms of rx subscription lifecycle.

You can check other discussion here.

Ivan
  • 43
  • 4