Skip to content
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

Auto attach causing issues when debugging in integrated terminal #49403

Closed
roblourens opened this issue May 7, 2018 · 14 comments

Comments

@roblourens
Copy link
Member

commented May 7, 2018

  • enable auto attach
  • Start a basic node launch config with "console": "integratedTerminal".
  • Wait 10s
  • Get an error that we couldn't attach to the process, and I assume that it has detected the same process that I am currently debugging:

image

Was this always the case? We could somehow suppress this particular error in this case.

@rsweetland

This comment has been minimized.

Copy link

commented May 15, 2018

I think this is isolated it to commands that spawn more than one node process.

For example, nodemon server.js spawns two node processes which you can see with ps -a | grep node.

Starting in the debugger nodemon server.js --inspect-brk apparently spawns two node processes, each with --inspect-brk appended. VS Code seems to be trying to attach to both of them, with the second one timing out after 10 seconds.

image

When I just use node server.js --inspect-brk it spawns only one process which VS Code properly handles.

I ran into the issue myself with mocha -w mocha --require (Edit: turns out --require was the culprit)

A quick fix might be to expose a timeout preference allowing for an "infinite" value. That would allow continued debugging of child processes. This is assuming that VS code continues to guess the right process to connect to, which is has each time for me.

@weinand

This comment has been minimized.

Copy link
Member

commented Aug 27, 2018

fixed by:

  • ignoring auto-attach requests when a debug config launch is under way for the integrated terminal
  • suppressing attach timeouts for auto-attach launch configurations
@isidorn

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

I still see this with latest insiders following @roblourens steps -> reopening

@isidorn isidorn reopened this Aug 28, 2018

@isidorn isidorn added verification-found and removed verified labels Aug 28, 2018

@weinand

This comment has been minimized.

Copy link
Member

commented Aug 28, 2018

Since I cannot reproduce, please provide more details:

  • platform
  • program you are using
  • screenshot of the error

And make sure that you are using version 1.27.5 of node-debug (legacy)

@isidorn

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

OS X, latest insiders
Node 8.9.1

Program I am using
console.log('test')

I am not using node-debug (legacy). I am using node2.
Unfortunetly I can not repro anymore (only saw it once).
Since I can no longer repro it is fine to close this if you want to and I will reopen if I see it again

@weinand

This comment has been minimized.

Copy link
Member

commented Aug 28, 2018

The auto attach code lives only in node-debug (legacy) and is shared with node-debug2.

How does you launch config look like?

@isidorn

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

{
            "type": "node",
            "request": "launch",
            "name": "Launch Program",
            "program": "${workspaceFolder}/hey.js",
            "console": "integratedTerminal"
        }
@weinand

This comment has been minimized.

Copy link
Member

commented Aug 28, 2018

and you have a breakpoint on line 1 of hey.js?

@isidorn

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

Yes I do

@isidorn

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

Tried around 10 times now, and still can not repro.

@weinand

This comment has been minimized.

Copy link
Member

commented Aug 28, 2018

it is ok if you stop after 1000... ;-)

@isidorn

This comment has been minimized.

Copy link
Contributor

commented Aug 28, 2018

😊

@weinand

This comment has been minimized.

Copy link
Member

commented Aug 29, 2018

After trying another 837 times, I was able to reproduce (and analyse the problem in the debugger).
There was a name mismatch between the property name emitted by node-debug ("__autoAttached") and the corresponding code in VS Code ("__autoAttach") .

@isidorn

This comment has been minimized.

Copy link
Contributor

commented Aug 30, 2018

Verified via code review and that I can still not repro :)

@isidorn isidorn added the verified label Aug 30, 2018

@vscodebot vscodebot bot locked and limited conversation to collaborators Oct 13, 2018

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
4 participants
You can’t perform that action at this time.