Skip to content
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

2.x: firstOrError call on dispose twice #6268

Closed
ibaca opened this issue Oct 29, 2018 · 1 comment
Closed

2.x: firstOrError call on dispose twice #6268

ibaca opened this issue Oct 29, 2018 · 1 comment

Comments

@ibaca
Copy link

ibaca commented Oct 29, 2018

In RxJava (2.2.2) if I use the next code the onDispose callback is called twice. I have already changed the code to not use this approach bc the s.onNext inside the subscribe is pretty obscure, but I report it just in case this can affect more cases. Looks like firstOrError (actually ObservableElementAtSingle) can call upstream cancelation twice.

Code that produces the problem:

BehaviorSubject<Integer> s = BehaviorSubject.create();
s.doOnLifecycle(d -> out.println("subscribe"), () -> { out.println("dispose"); s.onNext(2); })
        .firstOrError().subscribe().dispose();

Console output:

subscribe
dispose
dispose
@akarnokd
Copy link
Member

This is kind of an awkward reentrance problem. I'll have to investigate which components need to suppress dispose calls.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants