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

ProcessPool spawns more and more processes #16

Open
moshez opened this issue Dec 14, 2017 · 1 comment
Open

ProcessPool spawns more and more processes #16

moshez opened this issue Dec 14, 2017 · 1 comment

Comments

@moshez
Copy link
Contributor

moshez commented Dec 14, 2017

It seems that under certain circumstances, if a worker process exits abnormally, ProcessPool will spawn two new processes to replace it. This ignores the maximum worker limit the ProcessPool is configured with, so eventually enough processes will be spawned so as to consume all available system resources.

I don't completely understand why this happens, but I know that the "second" replacement process is spawned by the startAWorker call attached to the stopAWorker Deferred in _cb_doWork. This may be because the Shutdown call issued by stopAWorker fails with ProcessTerminated. This results in the Deferred succeeding instead of failing, allowing the startAWorker callback to run. Additionally, when the process exits, it gets restarted by the logic in _addProcess. Just a guess, though.

(In general I think all this code should (and could be) be a lot simpler.)

@heyakyra
Copy link

I have noticed this as well

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