JakeWharton/RxReplayingShare

NPE on switchMap operators downstream from ReplayingShare

kxfang opened this issue · 6 comments

Originally reported here: ReactiveX/RxJava#6224

There's a possible protocol violation in ReplayingShare that calls onNext on the downstream switchMap before onSubscribe is called.

The code indicates that to be impossible, no?

Yeah, I spent like an hour trying to reproduce with different tests (we work together with @kxfang), it seems impossible to me too 🤷‍♀️

@artem-zinnatullin can correct me if I'm wrong, but we've had RxRelay in the code base for years and haven't had any similar issues. It's only when we started introducing ReplayingShare recently that we started seeing this crash affecting thousands of users. Maybe it's possible that the combination of the two is somehow causing issues?

Concurrent emission from upstream seems to be the only way to get into this state and replayinShare is prob just a part of the chain here

It's however a bit weird that all stacktraces we have have replayingShare in them, but that might just indicate a error pattern on our side

We stopped seeing these crashes after #31