Debug in cluster mode
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?
Can't debug in cluster mode using --node-args="--inspect" -i 4 . This works if not in cluster. If this is not possible any hints as to how a cluster could be properly debugged using a debugger are super welcome. I have an issue that only appears in cluster mode due to what I assume is some sort of race condition but I can not pin point the cause yet. Not being able to properly debug makes this extra hard.
EDIT
After looking at the report I see the below chrome dev tools url which does allow me to debug a single instance in the cluster. This is already very helpful but is it possible to see all instances?
chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5860/7d5db3f5-d94a-46a2-8bd2-5bd16c68aad8
How could we reproduce this issue?
Start a process with pm2 running the following command:
$ pm2 start app.js --node-args="--inspect" -i 4
Supporting information
PM2 | 2017-08-05 16:13:59: Starting execution sequence in -cluster mode- for app name:worker id:2
PM2 | 2017-08-05 16:13:59: Starting execution sequence in -cluster mode- for app name:worker id:3
PM2 | 2017-08-05 16:13:59: App name:worker id:2 online
PM2 | 2017-08-05 16:13:59: (node:36144) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2 | 2017-08-05 16:13:59: Starting execution sequence in -cluster mode- for app name:redirector id:4
PM2 | 2017-08-05 16:13:59: App name:worker id:3 online
PM2 | 2017-08-05 16:13:59: (node:36144) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2 | Debugger listening on port 5859.
PM2 | Warning: This is an experimental feature and could change at any time.
PM2 | To start debugging, open the following URL in Chrome:
PM2 | chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5859/a05918c8-0f34-4450-8c73-150b3057be80
PM2 | 2017-08-05 16:14:00: Starting execution sequence in -cluster mode- for app name:redirector id:5
PM2 | Debugger listening on port 5860.
PM2 | Warning: This is an experimental feature and could change at any time.
PM2 | To start debugging, open the following URL in Chrome:
PM2 | chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5860/7d5db3f5-d94a-46a2-8bd2-5bd16c68aad8
PM2 | 2017-08-05 16:14:00: App name:redirector id:4 online
PM2 | 2017-08-05 16:14:00: (node:36144) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
PM2 | 2017-08-05 16:14:00: App name:redirector id:5 online
PM2 | 2017-08-05 16:14:00: (node:36144) DeprecationWarning: worker.suicide is deprecated. Please use worker.exitedAfterDisconnect.
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 pm2 start app.js --node-args="--inspect" -i 4 and inspect how PM2 launches cluster workers with Node’s inspector enabled. The issue provides no source files or tests, so identify the relevant cluster and debugger entry points first. Done means all cluster instances can be debugged as requested, or the supported limitation is clearly documented.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- javascript, nodejs
- Domain
- cli, devtools, distributed-systems
- Issue type
- Bug
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100