-
Notifications
You must be signed in to change notification settings - Fork 7.3k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Unsubsribe from pending request leads to java.io.InterruptedIOException and memory leak #844
Comments
Same leak detected also for me |
Same for me. We just have to wait the release 2.0 with the new feature to cancel request I guess. |
+1 This issue is closed by reporter, but it's actually there. |
+1 for me as well. |
1 similar comment
+1 for me as well. |
+1 for me as well.
|
+1. Anybody knows if this issue got solved? |
@murki I had this issue on Retrofit 2 while running |
@romainpiel thanks, good to know. By the way when you say "But it should happen if both can run on separate threads.", do you mean "should" or "shouldn't"? Anyways, we're still running Retrofit 1.9, that's why I was wondering if there was a way to work around this issue pre-v2. |
Oh yeah sorry, "shouldn't" :) |
This issue is also affects caching in If you use |
anyone tried using .serialize() if that helps |
This issue occurs on Retrofit 2+ and OkHttpClient 3+, ( @pkliang ) I am not sure why this issue was closed, it's not resolved and no solution for this problem was given in comments. |
This issue still exists, Anybody knows if exists a workaround? |
+1, Anybody knows if this issue got solved? |
+1 Same error with Retrofit (2.1.0) and RxJava (1.1.9) / RxAndroid (1.2.1) A really ugly workaround but it works for me: this is my onError of my subscriber. I re-attach it to my Observable...
|
+1 for me as well. |
I'm getting this exception too while using rxjava + okhttp, why is this issue closed? |
I closed this issue because I thought it would be fixed in Retrofit2 which supports for request cancellation. Looks like this issue hasn't been fixed in Retrofit2, I reopened it. |
Thus far all stack traces in this issue are due to normal timeouts. |
I'm using a handcrafted thread pool that calls okhttp 2.7 + retrofit 1.9 once the thread count goes above 1 it's a matter of time until the app will encounter the problem. Timeout is set to 50 seconds... |
@AlexBonel can the cache be fixed by upgrading to Retrofit 2+? I'm currently caching on an app but when the user switch to another activity, it causes IOInterruptedException which in turn cause the cache in the app to stop working until restarted. |
I'm getting this exception too while using rxjava + okhttp, why is this issue closed? |
|
This is an old post, but for others who are searching for the cause to similar problems (like me...) @JakeWharton said:
But the code of Okio (buldled with 'com.squareup.okhttp3:okhttp:3.9.0') is: /**
* Throws an {@link InterruptedIOException} if the deadline has been reached or if the current
* thread has been interrupted. This method doesn't detect timeouts; that should be implemented to
* asynchronously abort an in-progress operation.
*/
public void throwIfReached() throws IOException {
if (Thread.interrupted()) {
throw new InterruptedIOException("thread interrupted");
}
if (hasDeadline && deadlineNanoTime - System.nanoTime() <= 0) {
throw new InterruptedIOException("deadline reached");
}
} So these stack traces match the description of the issue: unsubscribe interrupts the thread and throws this error. |
Any solution so far?
This is always causing error
|
is anyone able to resolve the error? |
still facing... |
I am using retrofit 2.7.2, still facing this problem, hasJournalErrors true is set, cache doesn't working |
|
I have a retrofit interface method returns an Observable, if unsubscribe it in onDestory() in an Activity or a Fragment while the request is in-progress, I always get a java.io.InterruptedIOException, and this leads to memory leak, I use LeakCanary for memory leak detection. I know currently there is no method to cancel request and I don't want to use Callback because I use Rxjava in my app, is there any way to avoid the memory leak?
The text was updated successfully, but these errors were encountered: