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] IllegalStateException on Observable.timer with 0 milliseconds #4926

Closed
nhaarman opened this issue Dec 19, 2016 · 4 comments
Closed

[2.x] IllegalStateException on Observable.timer with 0 milliseconds #4926

nhaarman opened this issue Dec 19, 2016 · 4 comments

Comments

@nhaarman
Copy link

  • Library version 2.0.3

The following test occasionally fails (about 200 out of 1000 fail):

@Test
fun test() {
    var t: Throwable? = null
    RxJavaPlugins.setErrorHandler { t = it }
    Observable.timer(0L, MILLISECONDS).blockingFirst()
    t?.let { throw it }
}

Stacktrace:

java.lang.IllegalStateException: Disposable already set!

	at io.reactivex.internal.disposables.DisposableHelper.reportDisposableSet(DisposableHelper.java:144)
	at io.reactivex.internal.disposables.DisposableHelper.setOnce(DisposableHelper.java:70)
	at io.reactivex.internal.operators.observable.ObservableTimer$IntervalOnceObserver.setResource(ObservableTimer.java:74)
	at io.reactivex.internal.operators.observable.ObservableTimer.subscribeActual(ObservableTimer.java:40)
	at io.reactivex.Observable.subscribe(Observable.java:10514)
	at io.reactivex.Observable.blockingFirst(Observable.java:4535)
	at myapp.MyTest.test(MyTest.kt:15)

Whenever the test fails, IntervalOnceObserver#setResource is called after it is disposed.

@akarnokd
Copy link
Member

Thanks for reporting. If the emission happens before the setResource call, the setResource will find the wrong reference there and complain about it. I'll fix it shortly.

@akarnokd
Copy link
Member

Closing via #4927

@guidedways
Copy link

Tried v2.0.2 in production and seeing a lot of these crashes come up. I know this has been fixed, but do we have an ETA for v2.0.4? Thank you.

@JakeWharton
Copy link
Contributor

See #4947

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

4 participants