You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
val testThread = Thread.currentThread();
rx.Observable.fromCallable { 10 }
.toV2()
.switchMap { original -> BehaviorSubject.createDefault(2)
.observeOn(Schedulers.io())
.map { multiplier ->
if (Thread.currentThread() == testThread) throw AssertionError()
original * multiplier
}
}
.subscribe { throw IllegalStateException("nice") }
Thread.sleep(1000)
This hits the assertion error as SwitchMapObserverpolls the inner query inside its drain method, running the poll method on MapObserver which ends up running on the thread the switchmap was subscribed to on (i think?).
I dont think the interop part is necessary to reproduce this bug, but was the consistent way I was able to get the drain method to poll the inner query as fromCallable emits a completion after the relay has emitted but before the mapper has received the event.
The text was updated successfully, but these errors were encountered:
Thanks for reporting. This is a bug in the fusion code of switchMap: it should report itself as a boundary just like flatMap to prevent this type of execution. I'll post a fix shortly. Until then you can apply hide() after map to prevent the fusion.
Here is the test case I've created
This hits the assertion error as
SwitchMapObserver
poll
s the inner query inside its drain method, running thepoll
method onMapObserver
which ends up running on the thread the switchmap was subscribed to on (i think?).I dont think the interop part is necessary to reproduce this bug, but was the consistent way I was able to get the
drain
method to poll the inner query asfromCallable
emits a completion after the relay has emitted but before the mapper has received the event.The text was updated successfully, but these errors were encountered: