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

[Insiders] Debugger kept in invalid state after process exits #124045

Closed
a0viedo opened this issue May 17, 2021 · 7 comments
Closed

[Insiders] Debugger kept in invalid state after process exits #124045

a0viedo opened this issue May 17, 2021 · 7 comments
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@a0viedo
Copy link

a0viedo commented May 17, 2021

Does this issue occur when all extensions are disabled?: Yes/No

  • VS Code Version: 1.57.0-insider
  • OS Version: Windows 10

I've tested this with all extensions disabled.

Steps to Reproduce:

  1. Start a node process with --inspect-brk that uses worker threads
  2. Attach the debugger
  3. Send a SIGINT signal to the process to terminate it
    image

Even if I click on disconnect nothing happens and the debugger still will be on screen. The only solution I've found is to force a "Reload Window".

I've uploaded a video of the reproduction too.

Code:

setInterval(() => {
    console.log('hi there')
}, 1000);

const { Worker } = require('worker_threads');
new Worker(``, { eval: true });
@weinand weinand added debug Debug viewlet, configurations, breakpoints, adapter issues info-needed Issue requires more information from poster labels May 17, 2021
@weinand
Copy link
Contributor

weinand commented May 17, 2021

Does the node process terminate properly if you send a SIGINT signal but have no debugger attached?

@a0viedo
Copy link
Author

a0viedo commented May 17, 2021

Yes, I would have to disable Auto Attach but it does exit properly. And sorry I didn't include the code for the repo, I've edited it and added that.

@connor4312
Copy link
Member

connor4312 commented May 17, 2021

Thanks for the issue. This is because you're debugging twice using both auto attach and a launch config. The 'target IDs' are set for the worker by Node, so the first debug session steals the target for the second session (since they're attaching to the same worker), causing an error to be thrown. This prevents the second session from initializing (and being able to be torn down).

A workaround is to remove the duplicate session, either:

  • Don't use auto attach and only Attach using a launch config
  • Use auto attach (with --inspect instead of --inspect-brk) instead of the launch config

@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug and removed info-needed Issue requires more information from poster labels May 17, 2021
@connor4312 connor4312 added this to the May 2021 milestone May 17, 2021
@a0viedo
Copy link
Author

a0viedo commented May 18, 2021

I see. Even with auto attach disabled there was still one debugger open so I couldn't get it work but after restarting the app it worked as expected. Thanks!

@connor4312
Copy link
Member

no problem, it should be fixed on nightly

@rzhao271 rzhao271 added the author-verification-requested Issues potentially verifiable by issue author label Jun 4, 2021
@rzhao271
Copy link
Contributor

rzhao271 commented Jun 8, 2021

@a0viedo has the issue been resolved for you (without having to use a workaround)?

@a0viedo
Copy link
Author

a0viedo commented Jun 9, 2021

@rzhao271 yes, when I managed to get two debuggers attached I had to restart VS Code and disable auto attach to get it working as expected.

@roblourens roblourens added the verified Verification succeeded label Jun 9, 2021
@github-actions github-actions bot locked and limited conversation to collaborators Jul 1, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests

5 participants