`pm2-runtime` stuck on launching with cluster mode, but worked fine with fork mode...
Open
Nobody has claimed this yet.
- Dominant language
- JavaScript
- Stars
- 43.3k
- Forks
- 2.7k
- PR merge metrics
- No merged PRs in 30d
Description
What's going wrong?
My ecosystem.config.js:
module.exports = {
apps: [{
script: './node_modules/.bin/ts-node',
args: '-r ./node_modules/tsconfig-paths/register ./server/server.js',
cwd: './',
name: 'jpk-web-v3',
env: {
'NODE_ENV': 'development'
},
env_production: {
'NODE_ENV': 'production'
},
exec_mode: 'cluster',
instances: 2
}]
}
After pm2-runtime path/to/ecosystem.config.js --env production, the process logged information below:
2021-01-19T11:41:04: PM2 log: Launching in no daemon mode
2021-01-19T11:41:04: PM2 log: App [jpk-web-v3:0] starting in -cluster mode-
2021-01-19T11:41:04: PM2 log: App [jpk-web-v3:0] online
2021-01-19T11:41:04: PM2 log: App [jpk-web-v3:1] starting in -cluster mode-
2021-01-19T11:41:04: PM2 log: App [jpk-web-v3:1] online
Then stuck on this situation, normally it should run some build log.
But all things work with fork mode:
Try to start server on port 81:
- Waiting...
Server start successfully at:http://localhost:81
Supporting information
--- PM2 report ----------------------------------------------------------------
Date : Tue Jan 19 2021 11:42:10 GMT+0800 (China Standard Time)
===============================================================================
--- Daemon -------------------------------------------------
pm2d version : 4.5.0
node version : 14.14.0
node path : /usr/local/bin/pm2
argv : /Users/zhangyongchao/.nvm/versions/node/v14.14.0/bin/node,/Users/zhangyongchao/.config/yarn/global/node_modules/pm2/lib/Daemon.js
argv0 : node
user : zhangyongchao
uid : 501
gid : 20
uptime : 0min
===============================================================================
--- CLI ----------------------------------------------------
local pm2 : 4.5.0
node version : 14.14.0
node path : /usr/local/bin/pm2
argv : /Users/zhangyongchao/.nvm/versions/node/v14.14.0/bin/node,/usr/local/bin/pm2,report
argv0 : node
user : zhangyongchao
uid : 501
gid : 20
===============================================================================
--- System info --------------------------------------------
arch : x64
platform : darwin
type : Darwin
cpus : Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
cpus nb : 8
freemem : 586412032
totalmem : 17179869184
home : /Users/zhangyongchao
===============================================================================
--- PM2 list -----------------------------------------------
┌─────┬───────────┬─────────────┬─────────┬─────────┬──────────┬────────┬──────┬───────────┬──────────┬──────────┬──────────┬──────────┐
│ id │ name │ namespace │ version │ mode │ pid │ uptime │ ↺ │ status │ cpu │ mem │ user │ watching │
└─────┴───────────┴─────────────┴─────────┴─────────┴──────────┴────────┴──────┴───────────┴──────────┴──────────┴──────────┴──────────┘
===============================================================================
--- Daemon logs --------------------------------------------
/Users/zhangyongchao/.pm2/pm2.log last 20 lines:
PM2 | 2021-01-19T11:26:28: PM2 log: Concurrent actions : 2
PM2 | 2021-01-19T11:26:28: PM2 log: SIGTERM timeout : 1600
PM2 | 2021-01-19T11:26:28: PM2 log: ===============================================================================
PM2 | 2021-01-19T11:40:58: PM2 log: PM2 successfully stopped
PM2 | 2021-01-19T11:42:10: PM2 log: ===============================================================================
PM2 | 2021-01-19T11:42:10: PM2 log: --- New PM2 Daemon started ----------------------------------------------------
PM2 | 2021-01-19T11:42:10: PM2 log: Time : Tue Jan 19 2021 11:42:10 GMT+0800 (China Standard Time)
PM2 | 2021-01-19T11:42:10: PM2 log: PM2 version : 4.5.0
PM2 | 2021-01-19T11:42:10: PM2 log: Node.js version : 14.14.0
PM2 | 2021-01-19T11:42:10: PM2 log: Current arch : x64
PM2 | 2021-01-19T11:42:10: PM2 log: PM2 home : /Users/zhangyongchao/.pm2
PM2 | 2021-01-19T11:42:10: PM2 log: PM2 PID file : /Users/zhangyongchao/.pm2/pm2.pid
PM2 | 2021-01-19T11:42:10: PM2 log: RPC socket file : /Users/zhangyongchao/.pm2/rpc.sock
PM2 | 2021-01-19T11:42:10: PM2 log: BUS socket file : /Users/zhangyongchao/.pm2/pub.sock
PM2 | 2021-01-19T11:42:10: PM2 log: Application log path : /Users/zhangyongchao/.pm2/logs
PM2 | 2021-01-19T11:42:10: PM2 log: Worker Interval : 30000
PM2 | 2021-01-19T11:42:10: PM2 log: Process dump file : /Users/zhangyongchao/.pm2/dump.pm2
PM2 | 2021-01-19T11:42:10: PM2 log: Concurrent actions : 2
PM2 | 2021-01-19T11:42:10: PM2 log: SIGTERM timeout : 1600
PM2 | 2021-01-19T11:42:10: PM2 log: ===============================================================================
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reproducing the issue with the shown ecosystem.config.js and the pm2-runtime command, comparing cluster mode with the working fork mode. Review the PM2 report and daemon logs for the launch path; done means cluster mode starts the application and produces the expected server startup logs.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 30/100