Non-fatal Exception: java.io.IOException: Canceled
at okhttp3.internal.http.RetryAndFollowUpInterceptor.intercept(RetryAndFollowUpInterceptor.java:119)
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$AsyncCall.execute(RealCall.java:147)
at okhttp3.internal.NamedRunnable.run(NamedRunnable.java:32)
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)
My gradle dependencies:
compile 'com.squareup.retrofit2:retrofit:2.1.0'
compile 'com.squareup.retrofit2:converter-jackson:2.1.0'
compile 'com.squareup.okhttp3:logging-interceptor:3.9.0'
Please let me know what is the issue and how to resolve this?
This is not an issue. You called cancel() on a Call and it's notifying your callback. If you want to ignore it, check isCanceled on the Call in the onFailure callback.
Hi Thanks a lot for the quick reply..
But want to understand the crash is not originating from onFailure, Then how could it be the case with onFailure.
@Override
public void onFailure(final Call call, final Throwable t) {
if (!call.isCanceled()) {
// Perform some UI
}
}
Will this solve my crash ?
I got the crash reproduced. Thank you so much for the hint.
@JakeWharton I have got the same error and the same stack in 3.12.0, but I don't call the call.cancel(). Now I'm confused about anything that will cause the result. I'm sorry that I can't provide some more useful information. I'm really obsessed with this problem.
@JakeWharton I have got the same error and the same stack in 3.12.0, but I don't call the call.cancel(). Now I'm confused about anything that will cause the result. I'm sorry that I can't provide some more useful information. I'm really obsessed with this problem.
I encountered a similar situation then I updated the okhttp3 to a new version and fixed it .
@JakeWharton I have got the same error and the same stack in 3.12.0, but I don't call the call.cancel(). Now I'm confused about anything that will cause the result. I'm sorry that I can't provide some more useful information. I'm really obsessed with this problem.
I encountered a similar situation then I updated the okhttp3 to a new version and fixed it .
Because only the version of 3.12.x can support the device below 5.0, so I won't update the okhttp3 to the newest version.
I have found that the cancel action is caused by timeout task, howerer, I don't understand why there are so many timeout error occured by okhttp but the httpclient won't.
@JakeWharton I have got the same error and the same stack in 3.12.0, but I don't call the call.cancel(). Now I'm confused about anything that will cause the result. I'm sorry that I can't provide some more useful information. I'm really obsessed with this problem.
I encountered a similar situation then I updated the okhttp3 to a new version and fixed it .
Because only the version of 3.12.x can support the device below 5.0, so I won't update the okhttp3 to the newest version.
I have found that the cancel action is caused by timeout task, howerer, I don't understand why there are so many timeout error occured by okhttp but the httpclient won't.
哥们,后来我发现不是OkHttp的问题,我发现是在BaseActivity销毁的时候取消了所有请求,再后来遇到相同的错误也都是相同的原因:某个隐蔽的地方做了取消操作
Most helpful comment
This is not an issue. You called
cancel()on aCalland it's notifying your callback. If you want to ignore it, checkisCanceledon theCallin theonFailurecallback.