pm2 cluster.js assertionError on node v0.11.14
I'm running a process using pm2 0.11.1, node v0.11.14 and the following command:
pm2 start bin/server.js --name api --merge-logs -i max -e /home/deploy/logs/stderr.log -o /home/deploy/logs/stdout.log -- -p 8000
But after sending a request to port 8000, pm2 and the server.js dies and I get the following log when running pm2 logs api:
[PM2] [[[[ PM2/God daemon launched ]]]]
[PM2] BUS system [READY] on port /home/deploy/.pm2/pub.sock
[PM2] RPC interface [READY] on port /home/deploy/.pm2/rpc.sock
[PM2] Starting execution sequence in -cluster mode- for app name:api id:0
[PM2] App name:api id:0 online
[PM2] AssertionError: false == true
[PM2] at SharedHandle.add (cluster.js:97:3)
[PM2] at queryServer (cluster.js:461:12)
[PM2] at Worker.onmessage (cluster.js:419:7)
[PM2] at ChildProcess.<anonymous> (cluster.js:673:8)
[PM2] at ChildProcess.emit (events.js:129:20)
[PM2] at handleMessage (child_process.js:323:10)
[PM2] at Pipe.channel.onread (child_process.js:351:11)
[PM2] [[[[ PM2/God daemon launched ]]]]
[PM2] BUS system [READY] on port /home/deploy/.pm2/pub.sock
[PM2] RPC interface [READY] on port /home/deploy/.pm2/rpc.sock
Any ideas about how to solve this issue?
Thanks!
Apparently PM2 daemon is dying:
deploy@api-prod-test:~/api$ pm2 status
┌──────────┬────┬─────────┬──────┬────────┬───────────┬────────┬─────────────┬──────────┐
│ App name │ id │ mode │ PID │ status │ restarted │ uptime │ memory │ watching │
├──────────┼────┼─────────┼──────┼────────┼───────────┼────────┼─────────────┼──────────┤
│ api │ 0 │ cluster │ 1454 │ online │ 0 │ 8s │ 91.160 MB │ disabled │
└──────────┴────┴─────────┴──────┴────────┴───────────┴────────┴─────────────┴──────────┘
Use `pm2 desc[ribe] <id>` to get more details
... server (port 8000) gets a request ...
deploy@api-prod-test:~/api$ pm2 status
[PM2] Spawning PM2 daemon
[PM2] Success
┌──────────┬────┬──────┬─────┬────────┬───────────┬────────┬────────┬──────────┐
│ App name │ id │ mode │ PID │ status │ restarted │ uptime │ memory │ watching │
└──────────┴────┴──────┴─────┴────────┴───────────┴────────┴────────┴──────────┘
Use `pm2 desc[ribe] <id>` to get more details
Can you show me what you're app do?
Use fork mode to temporarily fix this
Nothing special, just an express app with app.listen(port);
Sent from my iPhone
On Fri, Nov 14, 2014 at 8:36 PM, Alexandre Strzelewicz [email protected] wrote:
Can you show me what you're app do?
Use fork mode to temporarily fix this
Reply to this email directly or view it on GitHub: https://github.com/Unitech/PM2/issues/818#issuecomment-63140309
Also, I'm running on Ubuntu 14.04 (server). On Mac OS X Yosemite it's working fine.
This error happened when using fork mode:
[PM2] TypeError: Cannot read property 'repo_path' of null
[PM2] at /usr/local/lib/node_modules/pm2/lib/Worker.js:20:64
[PM2] at /usr/local/lib/node_modules/pm2/node_modules/vizion/lib/git.js:106:12
[PM2] at /usr/local/lib/node_modules/pm2/node_modules/vizion/lib/git.js:98:14
[PM2] at Object.oncomplete (fs.js:93:15)
[PM2] [PM2] WORKER STARTED with refreshing interval: 30000
[PM2] [[[[ PM2/God daemon launched ]]]]
The issue with the fork mode seems to be real. As for the cluster mode, the issue is with the cluster module and client UDP sockets.
We're tracking this on joyent/node#8195.
The repo_path issue has been fixed via https://github.com/Unitech/PM2/commit/2ff51d673b7ed1b091f4308aec40cd585881039b
$ npm install git://github.com/Unitech/pm2#master -g
Could you please try it and tell me if it's ok now? Thanks
Fork mode works fine now.
I think you can close this issue as the cluster module of node 0.11.x is to blame.
Thanks for your fast feedback. I also have this bug with cluster and UDP, hope it's gonna be fixed.