New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Debug stopOnEntry with autoAttachChildProcesses is not honored on node cluster forked processes #65697

Closed
garu57 opened this Issue Dec 26, 2018 · 2 comments

Comments

Projects
None yet
5 participants
@garu57
Copy link

garu57 commented Dec 26, 2018

  • 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.

vscode-debugger-test.zip

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 18 const 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.

@isidorn isidorn assigned weinand and unassigned isidorn Dec 27, 2018

@isidorn isidorn added the debug label Dec 27, 2018

@SergeyFromHell

This comment has been minimized.

Copy link

SergeyFromHell commented Jan 22, 2019

I have the same problem, but in my case debugger breaks (not in 100% cases but occasionly) on first line when child is started (which is unwanted for me).
My launch config:
{ ...
"request": "launch",
"autoAttachChildProcesses": true,
"stopOnEntry": false,
... }

@weinand

This comment has been minimized.

Copy link
Member

weinand commented Jan 22, 2019

fixed by propagating the "stopOnEntry" flag when attaching to child processes.

@weinand weinand closed this Jan 22, 2019

@weinand weinand added the bug label Jan 22, 2019

@weinand weinand added this to the December/January 2019 milestone Jan 22, 2019

@chrmarti chrmarti added the verified label Feb 1, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment