You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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 :)
The text was updated successfully, but these errors were encountered:
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.)
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:
After that the result is different on different versions of node:
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 :)
The text was updated successfully, but these errors were encountered: