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

Don't automatically forward debug ports in auto attach #107243

Closed
connor4312 opened this issue Sep 22, 2020 · 7 comments
Closed

Don't automatically forward debug ports in auto attach #107243

connor4312 opened this issue Sep 22, 2020 · 7 comments
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release remote-explorer Remote explorer view

Comments

@connor4312
Copy link
Member

js-debug's auto attach "smart" mode causes a process to enter auto attach, without explicit flags. When entering debug mode, we let the OS choose a random free port (0) since we don't need any specific port.

I noticed when working in a remote container that this caused a bunch of ports to automatically be forwarded in the remote.

Unfortunately this message is printed by Node and I cannot always stop it from printing.

Is there any way we could exclude the pattern Debugger listening on ... from automatic forwarding?

@connor4312 connor4312 changed the title Don't automatically forward ports in auto attach Don't automatically forward debug ports in auto attach Sep 22, 2020
@alexr00
Copy link
Member

alexr00 commented Sep 23, 2020

@connor4312 we can exclude based on "Debugger listening on", but are there cases where Node may print that message and it isn't coming form js-debug's auto attach? Is there some other information about the terminal or state in VS Code I can use to exclude that link?

@connor4312
Copy link
Member Author

connor4312 commented Sep 23, 2020

It will also be printed if running something like node --inspect manually. But I would venture to guess that in those cases people will probably be subsequently attaching with vscode, so forwarding would not be necessary since js-debug is a workspace extension.

If you wanted to hone in more specifically, you could include 127.0.0.1:9229, which is the default port --inspect listens on and auto attach will only use with a 1 in 65000-or-so chance.

@alexr00 alexr00 added bug Issue identified by VS Code Team member as probable bug remote-explorer Remote explorer view labels Sep 24, 2020
@alexr00 alexr00 added this to the September 2020 milestone Sep 24, 2020
@connor4312
Copy link
Member Author

Thanks!

@roblourens
Copy link
Member

I can't repro this in stable, and I don't see the notification when I trigger port forwarding another way, what am I missing?

@roblourens roblourens added the verification-steps-needed Steps to verify are needed for verification label Oct 2, 2020
@alexr00
Copy link
Member

alexr00 commented Oct 2, 2020

The notification is new this iteration, so no repro in stable. To verify:

  • run command Remote-Containers: Try a sample...
  • Choose the node sample
  • Make sure debug auto attach is on (command Debug: Toggle Auto Attach -> choose Smart)
  • In the integrated terminal run node server.js
  • Verify that you don't see the port forwarded notification.

@alexr00 alexr00 removed the verification-steps-needed Steps to verify are needed for verification label Oct 2, 2020
@roblourens
Copy link
Member

I don't see it, but do I expect to see it in this case?

image

@roblourens roblourens added the verified Verification succeeded label Oct 2, 2020
@alexr00 alexr00 reopened this Oct 5, 2020
@alexr00 alexr00 removed the verified Verification succeeded label Oct 5, 2020
@alexr00
Copy link
Member

alexr00 commented Oct 5, 2020

That case should forward the port.

@alexr00 alexr00 added the candidate Issue identified as probable candidate for fixing in the next release label Oct 5, 2020
@alexr00 alexr00 added the verification-found Issue verification failed label Oct 5, 2020
@alexr00 alexr00 closed this as completed Oct 6, 2020
@alexr00 alexr00 removed the verification-found Issue verification failed label Oct 6, 2020
@github-actions github-actions bot locked and limited conversation to collaborators Dec 4, 2020
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 candidate Issue identified as probable candidate for fixing in the next release remote-explorer Remote explorer view
Projects
None yet
Development

No branches or pull requests

4 participants
@roblourens @connor4312 @alexr00 and others