-
Notifications
You must be signed in to change notification settings - Fork 7.6k
Question about interrupted threads in RxJava2 #5024
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
Comments
Could you create a self contained unit test (in a gist)? Or you could apply doOnDisposed() everywhere to see if the problem is due to internal disposing. |
here is a self contained unit test that fails: with respect to |
Could you post the stacktrace at those doOnDispose placed to see what is calling through them. |
sure:
|
Thanks, I see the problem now: This has to be fixed on the operator level so I can't give you any workaround other than the clearing of the interrupted flag or a custom operator that suppresses cancellation if it comes after an onsuccess. |
Closing via #5027. |
thanks! |
hi,
i have a question that's similar to #4863, but a bit simpler. i am running into a strange issue that i have been able to simplify to a simple test case - what’s happening is, sometimes, by the time my most downstream method is called, the thread is interrupted (which causes issues because the code i call there bails if the thread is interrupted).
i've been able to simplify the code and repro using this:
by the time
exportBookmarks
is called, in many cases,Thread.currentThread().isInterrupted()
returnstrue
.my question is: why is the thread interrupted? (i am curious as to whether this is expected or if there is something i am misunderstanding or doing wrong).
observations:
subscribeOn
s except for the one inexportBookmarksObservable
, then i don’t see the issue (though it does change the behavior a bit in the sense that, with this, all workers are run on the same thread as opposed to each piece of work happening on a potentially different thread).doOnSuccess
infakeGetData()
, i find the thread is interrupted (and is the same thread thatexportBookmarks
gets called on, while also being interrupted). this also is the same as one of thefakeDataPiece
threads, which, at the time of its completion, is not interrupted.Thread.interrupted()
as suggested in Get RxCachedThreadScheduler-n when calling Disposable.dispose() #4863 also fixes the problem.i am using RxJava 2.0.4 - thanks!
The text was updated successfully, but these errors were encountered: