{"action":"created","issue":{"url":"https://api.github.com/repos/Unitech/pm2/issues/3163","repository_url":"https://api.github.com/repos/Unitech/pm2","labels_url":"https://api.github.com/repos/Unitech/pm2/issues/3163/labels{/name}","comments_url":"https://api.github.com/repos/Unitech/pm2/issues/3163/comments","events_url":"https://api.github.com/repos/Unitech/pm2/issues/3163/events","html_url":"https://github.com/Unitech/pm2/issues/3163","id":259190998,"number":3163,"title":"PM2 failes to determine \"cluster_mode\" for `0` or `max` instances","user":{"login":"Turneliusz","id":624797,"avatar_url":"https://avatars2.githubusercontent.com/u/624797?v=4","gravatar_id":"","url":"https://api.github.com/users/Turneliusz","html_url":"https://github.com/Turneliusz","followers_url":"https://api.github.com/users/Turneliusz/followers","following_url":"https://api.github.com/users/Turneliusz/following{/other_user}","gists_url":"https://api.github.com/users/Turneliusz/gists{/gist_id}","starred_url":"https://api.github.com/users/Turneliusz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Turneliusz/subscriptions","organizations_url":"https://api.github.com/users/Turneliusz/orgs","repos_url":"https://api.github.com/users/Turneliusz/repos","events_url":"https://api.github.com/users/Turneliusz/events{/privacy}","received_events_url":"https://api.github.com/users/Turneliusz/received_events","type":"User","site_admin":false},"labels":[],"state":"closed","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-09-20T14:47:02Z","updated_at":"2017-09-20T15:03:27Z","closed_at":"2017-09-20T14:56:41Z","author_association":"NONE","body":"On newest 2.7.0 (not tested previous version) PM2 is determining \"exec_mode\" as `fork_mode` instead of `cluster_mode` when specifying \"instances\" as: `0` or `max`. \r\n\r\nAccording to documentation:\r\n\r\n> max means that PM2 will auto detect the number of available CPUs and run as many processes as possible in load balanced mode\r\n\r\nSee: http://pm2.keymetrics.io/docs/usage/cluster-mode/\r\n\r\nSee attached example with working and failing configuration JSON files. Application fail to listen to the specified port as execution mode is fork instead of cluster. Work-around is forcing \"exec_mode\" to be `cluster_mode` when specyfing `0` or `max` value for \"instances\". \r\n\r\n[bug-pm2.zip](https://github.com/Unitech/pm2/files/1318111/bug-pm2.zip)\r\n"},"comment":{"url":"https://api.github.com/repos/Unitech/pm2/issues/comments/330880600","html_url":"https://github.com/Unitech/pm2/issues/3163#issuecomment-330880600","issue_url":"https://api.github.com/repos/Unitech/pm2/issues/3163","id":330880600,"user":{"login":"Turneliusz","id":624797,"avatar_url":"https://avatars2.githubusercontent.com/u/624797?v=4","gravatar_id":"","url":"https://api.github.com/users/Turneliusz","html_url":"https://github.com/Turneliusz","followers_url":"https://api.github.com/users/Turneliusz/followers","following_url":"https://api.github.com/users/Turneliusz/following{/other_user}","gists_url":"https://api.github.com/users/Turneliusz/gists{/gist_id}","starred_url":"https://api.github.com/users/Turneliusz/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/Turneliusz/subscriptions","organizations_url":"https://api.github.com/users/Turneliusz/orgs","repos_url":"https://api.github.com/users/Turneliusz/repos","events_url":"https://api.github.com/users/Turneliusz/events{/privacy}","received_events_url":"https://api.github.com/users/Turneliusz/received_events","type":"User","site_admin":false},"created_at":"2017-09-20T15:03:27Z","updated_at":"2017-09-20T15:03:27Z","author_association":"NONE","body":"In general what it means is that:\r\n\r\n~~~\r\npm2 start index.js -i max\r\n~~~\r\n\r\nis not an equivalent of:\r\n\r\n~~~\r\n{\r\n    \"apps\": [\r\n        {\r\n            \"script\": \"index.js\",\r\n            \"instances\": \"max\"\r\n        }\r\n    ]\r\n}\r\n~~~\r\n\r\nWe have been caught by this inconsistency really hard."}}
{"actor":{"display_login":"Turneliusz"}}