microsoft / microsoft/vscode-js-debug

On WSL2, terminating debugger does not release port, so browser requires restart

Open
#1,731 6 comments 1 reaction 1 assignee View on GitHub

@connor4312 is already working on this.

Since Jun 13, 2023.

bug info-needed
Dominant language
TypeScript
Stars
2k
Forks
373
Avg merge
1d 9m
Merged PRs (30d)
6

Description

Describe the bug
Note that this issue does NOT occur in the "legacy-chrome" extension and is the main problem I have hit since switching from type "legacy-chrome" to "type chrome". It's also an issue that I've had from the beginning of time using this extension, so it's not a new issue, but it is a major blocker to using the feature.

To Reproduce
Steps to reproduce the behavior:

  1. Get the latest VSCode version on WSL2 with windows running latest Chrome, and WSL2 running VSCode.
  2. Use launch.json config as follows:
{
      "type": "chrome",
      "request": "attach",
      "port": 9222,
      "name": "Chrome React app debugger",
      "url": "http://localhost:3000*",
      "webRoot": "${workspaceFolder}/app",
      "sourceMapPathOverrides": {
        "webpack:///./~/*": "${workspaceFolder}/node_modules/*",
        "webpack:///./*": "${workspaceFolder}/*",
        "webpack:///*": "*",
        "webpack:///src/*": "${workspaceFolder}/*",
        "/*": "${workspaceFolder}/*"
      }
    }
  1. Open your Windows chrome to a given page, e.g. http://localhost:3000
  2. Click the "play" button to start the debugger. Observe that it works as expected. Then either (a) click the "Disconnect" button OR close the browser window. Observe that the debugger stops.

Expected behavior: Going to https://localhost:3000 in a new tab loads the page as expected.
Actual behavior: the page is stuck on loading and requires a computer restart OR "netstat -ano | findstr :9222" and then "Taskkill /PID /F" to release the port and make it usable again (which kills all chrome windows, so if you have multiple tabs open like I do, it's a productivity killer).

Log File
vscode-debugadapter-3542ee4c.json.gz

VS Code Version:
1.79.1 (system setup)

Additional context
If you use the legacy vscode extension with the following setup instead of the above, it disconnects properly:

{
      "type": "legacy-chrome",
      "request": "attach",
      "port": 9222,
      "name": "Chrome React app debugger",
      "urlFilter": "http://localhost:3000*",
      "webRoot": "${workspaceFolder}/app",
      "sourceMapPathOverrides": {
        "webpack:///./~/*": "${workspaceFolder}/node_modules/*",
        "webpack:///./*": "${workspaceFolder}/*",
        "webpack:///*": "*",
        "webpack:///src/*": "${workspaceFolder}/*",
        "/*": "${workspaceFolder}/*"
}

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.