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
Closed

Auto attach causing issues when debugging in integrated terminal #49403

roblourens opened this issue May 7, 2018 · 14 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-needed Verification of issue is requested verified Verification succeeded
Milestone

Comments

@roblourens
Copy link
Member

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

@weinand weinand added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels May 7, 2018
@rsweetland
Copy link

rsweetland 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
Copy link
Contributor

weinand 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

@weinand weinand closed this as completed Aug 27, 2018
@weinand weinand added the verification-needed Verification of issue is requested label Aug 27, 2018
@isidorn isidorn added the verified Verification succeeded label Aug 28, 2018
@isidorn
Copy link
Contributor

isidorn 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 Issue verification failed and removed verified Verification succeeded labels Aug 28, 2018
@weinand
Copy link
Contributor

weinand 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
Copy link
Contributor

isidorn 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
Copy link
Contributor

weinand 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
Copy link
Contributor

isidorn commented Aug 28, 2018

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

@weinand
Copy link
Contributor

weinand commented Aug 28, 2018

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

@isidorn
Copy link
Contributor

isidorn commented Aug 28, 2018

Yes I do

@isidorn
Copy link
Contributor

isidorn commented Aug 28, 2018

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

@weinand
Copy link
Contributor

weinand commented Aug 28, 2018

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

@isidorn
Copy link
Contributor

isidorn commented Aug 28, 2018

😊

@weinand
Copy link
Contributor

weinand 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") .

@weinand weinand removed the verification-found Issue verification failed label Aug 29, 2018
@isidorn
Copy link
Contributor

isidorn commented Aug 30, 2018

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

@isidorn isidorn added the verified Verification succeeded 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.
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verification-needed Verification of issue is requested verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

4 participants