"java.lang.IllegalArgumentException: n >= 0 required" when unsubscribing
Saw this exception in crash logs, but haven't been able to reproduce it. Any ideas what the cause is?
java.lang.IllegalArgumentException: n >= 0 required
at rx.internal.operators.OperatorMerge$MergeProducer.request(OperatorMerge.java:128)
at rx.internal.operators.OperatorReplay$ReplaySubscriber.manageRequests(OperatorReplay.java:521)
at rx.internal.operators.OperatorReplay$InnerProducer.unsubscribe(OperatorReplay.java:716)
at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
at rx.Subscriber.unsubscribe(Subscriber.java:98)
at rx.internal.util.SubscriptionList.unsubscribeFromAll(SubscriptionList.java:124)
at rx.internal.util.SubscriptionList.unsubscribe(SubscriptionList.java:113)
at rx.Subscriber.unsubscribe(Subscriber.java:98)
https://github.com/ReactiveX/RxJava/blob/v1.0.14/src/main/java/rx/internal/operators/OperatorMerge.java#L128
Could you post the code (or equivalent) which exhibits this problem? Looks like there is a flatmap followed by a replay.
Found the problem. Fix in #3167.
Awesome, thanks for the speedy fix. As a workaround until there's an update to RX, is it be safe to wrap the unsubscribe call in a catch statement? I'd be discarding the entire source observable at that point also.
The bug can leave the operator in inconsistent state and could stop replaying altogether.
Fixed via #3167