Repository navigation
Closed
Labels
debugDebug viewlet, configurations, breakpoints, adapter issues
Description
- VSCode Version: 1.18.1
- OS Version: Windows 10 64bits
- Node Version: 8.6.0
When debugguing nodeJS applications in cluster mode, the debugger starts correctly but it does not print any console messages but the main/initialization ones. The debugger(Inspector) does not catch any break points.
It happens 50% of time, sometimes it works sometimes it doesn't.
It has started after the update that added the "outputCapture: std" option, when using std it duplicates all the console messages.
My launch.json:
{
"version": "0.2.0",
"configurations": [
{
"type": "node",
"request": "launch",
"protocol": "inspector",
"outputCapture": "console",
"name": "Launch WBA",
"useWSL": false,
"env": {
"NODE_ENV": "development"
},
"cwd": "${workspaceRoot}/server",
"outFiles": [
"${workspaceRoot}/server/dist/**/*.js.map",
"${workspaceRoot}/server/dist/**/*.js"
],
"program": "${workspaceRoot}/server/src/Main.ts",
"runtimeExecutable": null,
"runtimeArgs": [
"--nolazy",
"--no-warnings",
"--expose-gc",
"--inspect=9329"
],
"stopOnEntry": false,
"sourceMaps": true,
"address": "localhost",
"port": 9329
},
{
"name": "Launch WBA Chrome",
"type": "chrome",
"request": "launch",
"url": "https://localhost:3000",
"webRoot": "${workspaceRoot}/template",
"sourceMaps": true
},
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"name": "Attach to worker 1",
"stopOnEntry": false,
"address": "localhost",
"port": 9330,
"timeout": 30000
},
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"name": "Attach to worker 2",
"stopOnEntry": false,
"address": "localhost",
"port": 9331,
"timeout": 30000
},
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"name": "Attach to worker 3",
"stopOnEntry": false,
"address": "localhost",
"port": 9332,
"timeout": 30000
},
{
"type": "node",
"request": "attach",
"protocol": "inspector",
"name": "Attach to worker 4",
"stopOnEntry": false,
"address": "localhost",
"port": 9333,
"timeout": 30000
}
],
"compounds": [
{
"name": "Debug Cluster",
"configurations": [
"Launch WBA",
"Attach to worker 1",
"Attach to worker 2",
"Launch WBA Chrome"
]
}
]
}
Cluster and worker initialization:
node --nolazy --no-warnings --expose-gc --inspect=9329 dist\Main.js
Debugger listening on ws://127.0.0.1:9329/876fe2a6-67c9-4786-81c7-f9f3cf7e7756
WBA Cluster 6520 is running, available CPUS: 4 - Args ["--nolazy","--no-warnings","--expose-gc","--inspect=9329"]
Worker Id: 2 - PID: 7936 - Args ["--nolazy","--no-warnings","--expose-gc","--inspect=9329","--inspect-port=9331"]
Worker Id: 1 - Name: fileIntegrationWorker - PID: 12864 - Args ["--nolazy","--no-warnings","--expose-gc","--inspect=9329","--inspect-port=9330"]
tsconfig.json:
{
"compilerOptions": {
"noUnusedLocals": false,
"noUnusedParameters": false,
"experimentalDecorators": true,
"emitDecoratorMetadata": true,
"target": "ES6",
"module": "commonjs",
"outDir": "dist",
"rootDir": "src",
"sourceMap": true,
"typeRoots": [
"node_modules/@types"
],
"types": [
"node"
]
},
"include": [
"src/**/*.ts"
],
"exclude": [
"node_modules",
"dist"
]
}
Please let me know if you need more info.
Thanks!
Metadata
Metadata
Assignees
Labels
debugDebug viewlet, configurations, breakpoints, adapter issues
Activity
roblourens commentedon Dec 8, 2017
Could you run this with
"trace": trueand upload the log here? Thanksgustavomassa commentedon Dec 8, 2017
Hi Rob,
The log is attached. One thing that I observed is that sometimes it stops on the beginning of the class, even though there is not breakpoint there and "stopOnEntry" is false.
vscode-node-debug2.txt
Thanks
roblourens commentedon Dec 8, 2017
I guess that doesn't help me since it's not the log from the workers.
I've never tried this but I'm not sure why it wouldn't work. I guess I'm not sure exactly what the problems are though - is it printing log messages from the initial process, but not the worker processes, even when you are attached to them? When you use
"outputCapture": "std", you see all the messages, but duplicated?So you can never hit breakpoints? In any process or just in the worker processes?
Referring to log messages or breakpoints? Any pattern to this?
If you can share the project that would be really helpful.
gustavomassa commentedon Dec 8, 2017
Issue 1: Duplicated console messages when using "outputCapture": "std"
Issue2: Workers breakpoints are not working correctly, sometimes it works sometimes it does not, when it does not work, the console messages are not duplicated.
This is the log related just to workers debug. This log is a case when the workers breakpoints started working normally(Hitting breakpoints), but after debugging using F6 and the debugger entered on an internal breakpoint then stopped working.
OBS: I'm debugging .ts files using sourmaps.
Unfortunately I can't share the entire project, but feel free to ask anything else.
vscode-node-debug2.txt
Thanks
gustavomassa commentedon Dec 12, 2017
New issues:
1 - Sometimes when debugging with F5 the debugger gets lost, and goes into .js files rather than .ts files.
No pattern identified yet.
2 - Sometimes Vscode breakpoints disappear, but it stills catch the breakpoints, so you need to add and then remove the breakpoint again to fix it.
This is a .zip containing the main files of cluster and server, also the vscode folder and gulpfile used to generate the .js files. Please let me know if you need anything else.
vscode.zip
Thanks
weinand commentedon Dec 12, 2017
Gustavo Massaneiro (@gustavomassa) You might want to try this: #40123
gustavomassa commentedon Dec 13, 2017
Andre Weinand (@weinand)
Sure! How can I help you testing it?
I don't think my issues are related to debugger being able to attach the workers correctly, because vscode always attaches to workers and start the workers code properly, but not always catch the workers breakpoints. But let me give it a try :)
I think my issues are related to the source map, the gulp is generating the sourcemaps inline properly, but for some reason sometimes vscode is not able to find it, maybe a timeout/synchronization issue.
Thanks
gustavomassa commentedon Jan 12, 2018
Hello,
Issue understood and resolved.
I have 4 cores on my cluster, but I'm attatching just 2 workers on the Debuger, therefore the debugger was not catching the breakpoints but sometimes was. The reason is simple, I have 4 workers running and just 2 debugguers attatched to it, so I had 50% of chance to attach the right worker and catch the breakpoint.
The new feature "autoAttachChildProcesses" should fix the issue.
Thank you!
weinand commentedon Jan 12, 2018
Gustavo Massaneiro (@gustavomassa) thanks for coming back to us and closing this issue!