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

"java.lang.IllegalArgumentException: n >= 0 required" when unsubscribing #3166

Closed
danhawkes opened this issue Aug 20, 2015 · 5 comments
Closed
Labels

Comments

@danhawkes
Copy link

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

@akarnokd
Copy link
Member

Could you post the code (or equivalent) which exhibits this problem? Looks like there is a flatmap followed by a replay.

@akarnokd
Copy link
Member

Found the problem. Fix in #3167.

@danhawkes
Copy link
Author

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.

@akarnokd
Copy link
Member

The bug can leave the operator in inconsistent state and could stop replaying altogether.

@akarnokd
Copy link
Member

akarnokd commented Sep 3, 2015

Fixed via #3167

@akarnokd akarnokd closed this as completed Sep 3, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants