Unitech/pm2

Fork mode by default for Node.js 0.10.x

Unitech opened this issue · 8 comments

Should PM2 start application in fork mode by default for Node.js 0.10.x ?

It would avoid some issues like:

  • port is not freed when deleting the process
  • other errors (#669)

👍

It'll add a new issue:

  • a lot of confused users

If you are to make it default, it probably should be done for all node.js versions, not just 0.10.

The fact is that 0.10 is not cluster friendly but 0.11 and so, 0.12 will be. It's sad not to use the cluster mode when it's totally safe to use it.

We could also mention in the README or with a pm2 warning that < 0.11 will be buggy by using cluster mode as it was in one of previous pm2 version.

It's sad not to use the cluster mode when it's totally safe to use it.

It's never totally safe to use it.

Things like process.mainModule will surely make an impression that pm2 broke on update from node 0.10 to 0.11.

I'm in to make the default exec mode to fork_mode for every node versions.
If there is the -i option then switch to cluster mode

OK, now if you start an app the mode is fork_mode.
Otherwise if you start an app with the -i <instances> parameter it launches the app in cluster mode.

This is a big strategic change ! But will incur more stability for all Node.js version and less weird bugs.

The change is starting from the PM2 0.10.7 version.

Long live to PM2 !

damned: a99bd4d#diff-11b18b3af4c330a60bff03e3abab63a6R199

Now script started with cluster mode are set a main script

  • process.mainModule is ok
  • module.parent is ok