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

Restarting processes in cluster module #3044

Closed
ctizen opened this issue Sep 24, 2015 · 2 comments
Closed

Restarting processes in cluster module #3044

ctizen opened this issue Sep 24, 2015 · 2 comments
Labels
cluster Issues and PRs related to the cluster subsystem. question Issues that look for answers.

Comments

@ctizen
Copy link

ctizen commented Sep 24, 2015

Hello,

I have a nodejs application that consumes much memory, and trying to run it using cluster module. I noticed some weird thing, but I don't know if it is a bug :)
I think these steps may lead to this behavior:

  • Get a virtual environment (Linux) with small amount of RAM (for example, 512M) and no swap.
  • Create an express app that consumes much memory on request and run it with cluster module.
  • Try to make some requests on it.

After that the result is different on different versions of node:

  • In node v0.10.x when process runs out of memory, it's being killed by OOM killer and then restarted by cluster module almost instantly. So on node v0.10 the count of working processes always matches the number in the config.
  • In node 0.12 the cluster module was totally broken (by this AssertionError: false == true at SharedHandle.add (cluster.js:97:3) node-v0.x-archive#9261) and the fix has landed only in node v4. After this patch, in node 4.0 the killed process is not restarted at all. In node 4.1 I noticed that such processes are restarted somehow (although I saw no logic in it), but the count of processes is still lower than I've set in the config. I don't think this is an expected behavior.

Also I've noticed that when I kill the child process manually with SIGTERM or SIGABRT, it's being restarted.

So the question is: is cluster expected to keep the same number of working processes in this case? I'm ready to assist in tracing this, but I don't know where to start.

P.S> Yes, there's an obvious advice to eliminate memory leaks in the app, but application is huge and such work costs too high to be done quickly, moreover in previous version of node I don't have this issue. That's why I'm asking for help here :)

@brendanashworth brendanashworth added the cluster Issues and PRs related to the cluster subsystem. label Sep 24, 2015
@mscdex mscdex added the question Issues that look for answers. label Sep 24, 2015
@bnoordhuis
Copy link
Member

The cluster module doesn't restart workers, such policy decisions are left to the higher levels of the stack.

I'm going to close the issue. The behavior you're describing doesn't originate in node itself but in whatever module sits on top of the cluster module (express or something on top of express.)

@ctizen
Copy link
Author

ctizen commented Sep 30, 2015

Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cluster Issues and PRs related to the cluster subsystem. question Issues that look for answers.
Projects
None yet
Development

No branches or pull requests

4 participants