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: NPE at ObservableReplay.ReplayObserver.dispose() #5060

Closed
hvisser opened this issue Feb 3, 2017 · 3 comments
Closed

2.x: NPE at ObservableReplay.ReplayObserver.dispose() #5060

hvisser opened this issue Feb 3, 2017 · 3 comments

Comments

@hvisser
Copy link

hvisser commented Feb 3, 2017

Stack trace below shows a crash that I unfortunately can't reproduce currently. I've checked the source for ObservableReplay.ReplayObserver and it looks like this can only happen if it's being disposed before being subscribed which sounds odd to me? What might be relevant is that unsubscribeOn() is used on the observable.

java.lang.NullPointerException: Attempt to invoke interface method 'void io.reactivex.disposables.Disposable.dispose()' on a null object reference
    at io.reactivex.internal.operators.observable.ObservableReplay$ReplayObserver.dispose(ObservableReplay.java:361)
    at io.reactivex.disposables.CompositeDisposable.dispose(CompositeDisposable.java:216)
    at io.reactivex.disposables.CompositeDisposable.dispose(CompositeDisposable.java:79)
    at io.reactivex.internal.operators.observable.ObservableRefCount$2.run(ObservableRefCount.java:126)
    at io.reactivex.disposables.RunnableDisposable.onDisposed(RunnableDisposable.java:28)
    at io.reactivex.disposables.RunnableDisposable.onDisposed(RunnableDisposable.java:18)
    at io.reactivex.disposables.ReferenceDisposable.dispose(ReferenceDisposable.java:42)
    at io.reactivex.internal.operators.observable.ObservableRefCount$ConnectionObserver.dispose(ObservableRefCount.java:181)
    at io.reactivex.internal.disposables.DisposableHelper.setOnce(DisposableHelper.java:79)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$SubscribeOnObserver.onSubscribe(ObservableSubscribeOn.java:58)
    at io.reactivex.internal.operators.observable.ObservableRefCount.doSubscribe(ObservableRefCount.java:113)
    at io.reactivex.internal.operators.observable.ObservableRefCount$1.accept(ObservableRefCount.java:98)
    at io.reactivex.internal.operators.observable.ObservableRefCount$1.accept(ObservableRefCount.java:92)
    at io.reactivex.internal.operators.observable.ObservableReplay.connect(ObservableReplay.java:305)
    at io.reactivex.internal.operators.observable.ObservableRefCount.subscribeActual(ObservableRefCount.java:68)
    at io.reactivex.Observable.subscribe(Observable.java:10514)
    at io.reactivex.internal.operators.observable.ObservableSubscribeOn$1.run(ObservableSubscribeOn.java:39)
    at io.reactivex.Scheduler$1.run(Scheduler.java:134)
    at io.reactivex.internal.schedulers.ScheduledRunnable.run(ScheduledRunnable.java:59)
    at io.reactivex.internal.schedulers.ScheduledRunnable.call(ScheduledRunnable.java:51)
    at java.util.concurrent.FutureTask.run(FutureTask.java:237)
    at java.util.concurrent.ScheduledThreadPoolExecutor$ScheduledFutureTask.run(ScheduledThreadPoolExecutor.java:272)
    at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1133)
    at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:607)
    at java.lang.Thread.run(Thread.java:761)
@akarnokd
Copy link
Member

akarnokd commented Feb 3, 2017

Thanks for reporting, this is a bug. What happens is that the asnyc dispose happens before the chain of onSubscribe call reaches the operator. The same happens inside FlowableReplay. I'll post a fix shortly.

@akarnokd
Copy link
Member

akarnokd commented Feb 3, 2017

See #5064

@akarnokd
Copy link
Member

akarnokd commented Feb 3, 2017

Closing via #5064

@akarnokd akarnokd closed this as completed Feb 3, 2017
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