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
Scheduler shutdown capability #3149
Conversation
We still need to decide on the reset vs shutdown distinction: #3022 (comment) What is your perspective? Do you have a strong opinion one way or another? |
With start/shutdown, there is a clear intention to stop everybody. With reset, any running code could respawn the threads and the new threads will resume leaking. I prefer start/shutdown. |
Agree, it will be great to have ability to stop Schedulers and prevent new workers from scheduling for apps that run in Servlets and other similar containers which can be stopped externally. |
* This assumes Spsc or Spmc usage. This means only a single producer calling the on* methods. This is the Rx | ||
* contract of an Observer (see http://reactivex.io/documentation/contract.html). Concurrent invocations of | ||
* on* methods will not be thread-safe. | ||
* This assumes Spsc or Spmc usage. This means only a single producer calling the on* methods. This is the Rx contract of an Observer. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'll change back the comment shortly.
7c614d0
to
883e8fc
Compare
I'm happy with the start/shutdown pair which seems to support my primary use cases:
Thanks @akarnokd! |
the |
I'll following this thread to be notified when it's merged. Thanks @akarnokd |
@benjchristensen do you consider we have consensus on naming? after that it'd be showtime 🎬 😂 |
🆙 because so many customers from us run into this. |
@daschl 👍 |
I would like a bit more context on what the goal is for the scheduler shutdown capability. @davidmoten and any others, please respond. Thanks.
What resources exactly need to be freed? Shutting down the schedulers would prevent new workers from being scheduled and would free up threads from the executor. Is this the desired behavior or is there some side effect that you are looking for?
Could anyone name a framework that's impacted? Is the concern that open threads keep the framework from properly terminating?
Would the |
@stealthcode I can answer the question 2. I hope it help you. Could anyone name a framework that's impacted? Is the concern that open threads keep the framework from properly terminating?
CB SDK are not able to finish some of they own threads because it is referring RxComputationThreadPool threads who can't be finished. You can see more details about how this issue are affecting this framework here. |
@stealthcode I can give you the answer to your questions, too. I'd like to use RxJava in the container (e.g. I'd like to use Jersey Rx Client on Tomcat). Unfortunately, it is impossible to shutdown RxComputationThreadPool-* threads and container has memory leaks. That causes that RxJava is inapplicable for my purposes :( And in my case - regarding question 1 - yes, shutting down all schedulers permanently is a desired behaviour. And TestScheduler is not a solution. |
@mjakubowski84 👍 similar case here. |
@mjakubowski84 understood. regarding the TestScheduler - this is meant for use in tests and highly recommended. When it comes to a container you would definitely want to use a real scheduler. So, what I hear is that there is no desire to resume the scheduler once it is shut down. My concern is that by offering a |
I don't have strong opinion between shutdown/teardown. Otherwise the code LGTM 👍 |
Another thing, if we want to be more java idiomatic, maybe hiding the |
I can make |
Please do, I believe that would be better. |
Done. |
@akarnokd @stevegury folks, do you think its possible to get this into 1.0.15? |
@akarnokd thanks. |
I think this is fine 👍 |
Do you guys have a plan date to merge it? |
@akarnokd I think it's appropriate that you merge this PR since you are most familiar with this code. If you think you are happy with it then feel free. |
Oh, sorry, didn't recount the number of likes. Merging. |
Where can I get the latest build with this fix? Maven central is still at 1.0.14. |
@chiangh123 you can clone the project and build it from master. Good luck :) |
<repository>
<snapshots />
<id>snapshots</id>
<name>libs-snapshot</name>
<url>http://oss.jfrog.org/artifactory/libs-snapshot</url>
</repository> After that you should be able to depend on rxjava |
Repost of #3022.