JakeWharton / RxReplayingShare

An RxJava transformer which combines replay(1), publish(), and refCount() operators.
Apache License 2.0
628 stars 28 forks source link

NPE on switchMap operators downstream from ReplayingShare #30

Closed kxfang closed 5 years ago

kxfang commented 5 years ago

Originally reported here: https://github.com/ReactiveX/RxJava/issues/6224

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

JakeWharton commented 5 years ago

The code indicates that to be impossible, no?

artem-zinnatullin commented 5 years ago

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

JakeWharton commented 5 years ago

Are we sure the problem is here and not RxRelay? It's in the original trace.

On Thu, Feb 14, 2019 at 2:14 PM Artem Zinnatullin :slowpoke: < notifications@github.com> wrote:

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

— You are receiving this because you commented.

Reply to this email directly, view it on GitHub https://github.com/JakeWharton/RxReplayingShare/issues/30#issuecomment-463754609, or mute the thread https://github.com/notifications/unsubscribe-auth/AAEEEcMkEhZFt1vxckCLj8VcRYFfGJMoks5vNbWsgaJpZM4a8Gty .

kxfang commented 5 years ago

@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?

artem-zinnatullin commented 5 years ago

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

kxfang commented 5 years ago

We stopped seeing these crashes after https://github.com/JakeWharton/RxReplayingShare/issues/31