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

Unable to dispose observables subscribed on threadpool scheduler #637

Open
AstrickHarren opened this issue Mar 20, 2022 · 1 comment
Open

Comments

@AstrickHarren
Copy link

Describe the bug
This code

pool = ThreadPoolScheduler()
run = rx.repeat_value(1).pipe(
    ops.subscribe_on(pool)
).subscribe()
sleep(.5)
run.dispose()

doesn't seems to be able to shutdown the repeat_value despite calling dispose.

To Reproduce
Just run the code above, you'll see the thread never ends. If it ends by OS, you can
make a debug breakpoint at ScheduledDisposable.dispose(..), (or even its init(..))
and you'll see it is never called.

  • OS [e.g. Mac Monetary]
  • RxPY version [e.g 3.2.0]
  • Python version [e.g. 3.10.2]
@AstrickHarren
Copy link
Author

I think the reason may be subscribe on will call on another subscription to the repeat_value with current thread scheduler, which appears to be synchronous due to the fact it constantly schedules next repeated value, and so the disposable here is never of is never set to be ScheduledDisposable?

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

1 participant