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

Extension debugging doesn't work with two IP6 network interfaces #144315

Closed
weinand opened this issue Mar 3, 2022 · 7 comments · Fixed by microsoft/vscode-js-debug#1297
Closed
Assignees
Labels
bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Milestone

Comments

@weinand
Copy link
Contributor

weinand commented Mar 3, 2022

VS Code's Extension debugging fails with the following message when the computer is connected to two IP6 network interfaces, e.g. a wired ethernet and WLAN:

image

To make investigation of this problem easier I was able to find a simpler repro:

  • have your computer connected to two IP6 network interfaces, e.g. wired ethernet and WLAN
  • create "server.js" with this contents:
    let i = 0;
    setInterval(() => {
      console.log(`hello world ${i++}`);
    }, 1000);
    
  • launch server.js from VS Code's integrated terminal with node --inspect-brk=12345 server.js
  • create launch config:
    {
       "name": "Attach to server",
       "type": "node",
       "request": "attach",
       "port": 12345
    }
    
  • open chrome dev tool console
  • run "Attach to server" launch config

Observe:
debugger cannot attach to server and console shows this:

CleanShot 2022-03-03 at 12 35 07

  • add a "address": "127.0.0.1" to the launch config
  • run "Attach to server" launch config

Observe:
debugger attaches without problems.

  • replace "127.0.0.1" with "localhost" and try again

Observe:
debugger cannot attach to server.

So it seems that using "localhost" does not always work and we should use "127.0.0.1" instead when connecting to the debug port.

@connor4312 could you please make sure that js-debug uses "127.0.0.1" as a fallback.
This is especially important for extension debugging because there it is not possible to specify an explicit address in the launch config.

/cc @alexdima

@weinand weinand added bug Issue identified by VS Code Team member as probable bug debug Debug viewlet, configurations, breakpoints, adapter issues labels Mar 3, 2022
@weinand weinand added this to the March 2022 milestone Mar 3, 2022
@connor4312
Copy link
Member

I added some logic for this that fixed the cases I could reproduce: https://github.com/microsoft/vscode-js-debug/blob/65160926b7cafccdc71da54a9587c65d66ca73c4/src/adapter/resourceProvider/basicResourceProvider.ts#L94-L99

However, maybe this doesn't work for you. I don't believe I have ready access to such a network locally, can you set a breakpoint around those lines and see why the fallback doesn't happen (or fails) on your machine?

@weinand
Copy link
Contributor Author

weinand commented Mar 10, 2022

@connor4312 the fallback happens but doesn't help...

here is my setup:

  • open and build latest version of js-debug in VS Code Insiders
  • set breakpoint in "basicResourceProvider.ts":96
  • run "Debug Server" launch config
  • open another VS Code window with my "server.js" from above
  • add "debugServer": 4711 to launch config from above
  • run launch config
  • wait until breakpoint is hit
  • step and continue until error appears on debug console

Here is a recording:

CleanShot.2022-03-10.at.11.27.00.mp4

If I change the launch config to use "127.0.0.1" js-debug is able to attach just fine:

CleanShot.2022-03-10.at.11.43.01-converted.mp4

Please note, that I was not able to hit any breakpoints in server.js in my setup.

BTW, my network setup is:

  • in MS Zurich office
  • MacBook Pro connected via USB Ethernet Adapter and WiFi

@connor4312
Copy link
Member

If I don't get to this next debt week, I will just plan on tackling it in June when I'll be in the Zurich office solely for the opportunity to fix this bug ;)

@weinand
Copy link
Contributor Author

weinand commented Apr 29, 2022

@connor4312 wow, that's an excellent move ;-)

@kieferrm kieferrm modified the milestones: May 2022, June 2022 Jun 3, 2022
@connor4312
Copy link
Member

Looked into this in person. What's happening is that, while the fallback does "work", the initial request to localhost is timed out. The fallback happens, but the cancellation token is already cancelled at that point.

@connor4312
Copy link
Member

Verified by @weinand

@connor4312 connor4312 added the verified Verification succeeded label Jun 29, 2022
@weinand
Copy link
Contributor Author

weinand commented Jun 30, 2022

@connor4312 since I'm in the office today, I could actually verify that this issue has been fixed in Insiders.

@github-actions github-actions bot locked and limited conversation to collaborators Jul 24, 2022
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 verified Verification succeeded
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants