Description
- VSCode Version:
Version: 1.30.1
Commit: dea8705
Date: 2018-12-18T18:12:07.165Z
Electron: 2.0.12
Chrome: 61.0.3163.100
Node.js: 8.9.3
V8: 6.1.534.41
OS: Windows_NT x64 10.0.17134
Version: 1.31.0-insider
Commit: e02e444
Date: 2018-12-21T06:20:35.852Z
Electron: 3.0.10
Chrome: 66.0.3359.181
Node.js: 10.2.0
V8: 6.6.346.32
OS: Windows_NT x64 10.0.17134
App running with Node 10.5.0
Steps to Reproduce:
Try to debug the attached sample project.
Does this issue occur when all extensions are disabled?: Yes
I'm trying to debug an application using Node cluster, whose forked processes, once given control, won't wait for any further input and immediately start their task, ending as soon as they are finished.
I reproduced the problem in the attached sample.
In the launch.json
you see a couple of configs Launch Parent
, that calls directly the parent code and Launch and Attach to Parent
that calls parent code through npm
.
Bot configs are using
"autoAttachChildProcesses": true,
"stopOnEntry": true
because I want the debugger to stop children processes (in the sample I'm using just one, but it's enough to show the problem) before they start processing any code.
The problem is that with both configs, stopOnEntry
is honored only in parent.js
, when the child.js
process is forked the debugger is attached to it, but the execution is not stopped on the first line and the process goes to end without letting me stepping in the code.
I can obtain the stop on the first line of the child.js
either by putting a breakpoint on it, but you know, that's not a real stopOnEntry
, or using a trick, that's not practicable if you have more that one child process:
- set breakpoint into
parent.js
on line 18const worker = cluster.fork();
- launch the
Launch and Attach to Parent
config and advance till the breakpoint - launch the
Attach to Child
config - within the timeout execute the fork line
Now the debugger attaches to the child process and the execution is stopped on the first line.
But unless I misunderstood the meaning of autoAttachChildProcesses
, I would expect that child process stops execution on entry simply running any of Launch Parent
or Launch and Attach to Parent
configs.