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

Recursive scheduler fails to unsubscribe from time to time (RxJava 15.1 on Android) #758

Closed
lexer opened this issue Jan 16, 2014 · 6 comments

Comments

@lexer
Copy link

lexer commented Jan 16, 2014

  Scheduler threadPoolScheduler = Schedulers.executor(Executors.newFixedThreadPool(3));

  Subscription subscription = threadPoolScheduler.schedule(0L, new Func2<Scheduler, Long, Subscription>() {

                @Override
                public Subscription call(Scheduler inner, Long t2) {
                    return inner.schedule(t2, this, 1000, TimeUnit.MILLISECONDS);
                }
            });
        }

    });

   // unsubscribe when app worked several hours:
  subscription.unsubscribe()

It seems that current implementation of recursive scheduler become unstable when it accumulates too much subscriptions. May be subscriptions should not be accumulated and be substituted instead.

rx.util.CompositeException: Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed to unsubscribe to 1 or more subscriptions. => , CompositeException:Failed t

@benjchristensen
Copy link
Member

I believe this should be fixed as of 0.16.0 when Schedulers were more-or-less re-implemented to fix the memory leaks they had when doing recursion.

See #712 for the fix.

Recursion testing can be seen here: https://github.com/Netflix/RxJava/blob/master/rxjava-core/src/test/java/rx/schedulers/TestRecursionMemoryUsage.java

@lexer
Copy link
Author

lexer commented Jan 16, 2014

@benjchristensen great! I will try to do android specific load test this week.

Have tested with app that worked for 4 hours seems to work without crush.

@benjchristensen
Copy link
Member

After testing, please let me know if the issue is resolved and close this out or whether you still see problems.

@lexer
Copy link
Author

lexer commented Jan 16, 2014

sure!

@lexer
Copy link
Author

lexer commented Jan 27, 2014

@benjchristensen sorry for delay. but seems that with 16.1 problem is fixed.

@lexer lexer closed this as completed Jan 27, 2014
@benjchristensen
Copy link
Member

Excellent, thank you for the confirmation.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants