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

ECONNREFUSED debugging browsers in WSL2 #120227

Closed
joaomoreno opened this issue Mar 31, 2021 · 29 comments
Closed

ECONNREFUSED debugging browsers in WSL2 #120227

joaomoreno opened this issue Mar 31, 2021 · 29 comments
Assignees
Labels
author-verification-requested Issues potentially verifiable by issue author bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded

Comments

@joaomoreno
Copy link
Member

In our selfhosting setup, pressing F5 will yield this notification after about a minute of launching:

image

When inspecting the toolbar, I see the shared process is missing:

image

@bpasero Could it be related to the introduction of the sandbox?

@joaomoreno joaomoreno added bug Issue identified by VS Code Team member as probable bug engineering VS Code - Build / issue tracking / etc. and removed bug Issue identified by VS Code Team member as probable bug labels Mar 31, 2021
@joaomoreno joaomoreno added this to the April 2021 milestone Mar 31, 2021
@bpasero
Copy link
Member

bpasero commented Mar 31, 2021

Sandbox is not enabled currently. It will probably not be enabled until end of this year, see #92164

@connor4312
Copy link
Member

Hm, I don't hit this on Windows or OSX, but don't have a WSL with X forwarding setup on hand to test your scenario. For a sanity check, do you see anything in the debug console when this happens?

@connor4312 connor4312 added the info-needed Issue requires more information from poster label Mar 31, 2021
@joaomoreno
Copy link
Member Author

joaomoreno commented Apr 1, 2021

No, it's empty. 😢

Edit: Actually...

[Extension Host] debugger listening on port 5870
src/vs/workbench/services/extensions/electron-browser/localProcessExtensionHost.ts:368
  ERR Failed to execute 'invoke' on 'CreateHTMLCallback': The provided callback is no longer runnable.: Error: Failed to execute 'invoke' on 'CreateHTMLCallback': The provided callback is no longer runnable.
    at ViewLayerRenderer._finishRenderingInvalidLines (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewLayer.js:399:64)
    at ViewLayerRenderer._finishRendering (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewLayer.js:461:26)
    at ViewLayerRenderer.render (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewLayer.js:330:18)
    at VisibleLinesCollection.renderLines (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewLayer.js:263:37)
    at ViewLines.renderText (file:///home/joao/Work/vscode/out/vs/editor/browser/viewParts/lines/viewLines.js:427:32)
    at View._actualRender (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewImpl.js:246:33)
    at file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewImpl.js:218:40
    at safeInvokeNoArg (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewImpl.js:372:20)
    at View._renderNow (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewImpl.js:218:13)
    at View._flushAccumulatedAndRenderNow (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewImpl.js:111:18)
    at View.render (file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewImpl.js:313:22)
    at file:///home/joao/Work/vscode/out/vs/editor/browser/view/viewImpl.js:23:22
    at Emitter.fire (file:///home/joao/Work/vscode/out/vs/base/common/event.js:479:38)
    at WorkbenchThemeService.applyTheme (file:///home/joao/Work/vscode/out/vs/workbench/services/themes/browser/workbenchThemeService.js:405:37)
    at themeData.ensureLoaded.then.Promise.reject.nls.localize._a (file:///home/joao/Work/vscode/out/vs/workbench/services/themes/browser/workbenchThemeService.js:342:33)
    at async Promise.all (index 0)
src/vs/platform/log/common/log.ts:296
[Extension Host] debugger inspector at chrome-devtools://devtools/bundled/inspector.html?experiments=true&v8only=true&ws=127.0.0.1:5870/d3723330-8033-4379-a562-79d1d7342aa9

@connor4312 connor4312 changed the title Broken selfhost debug setup ECONNREFUSED debugging browsers in remotes Apr 1, 2021
@connor4312 connor4312 added bug Issue identified by VS Code Team member as probable bug candidate Issue identified as probable candidate for fixing in the next release debug Debug viewlet, configurations, breakpoints, adapter issues and removed engineering VS Code - Build / issue tracking / etc. info-needed Issue requires more information from poster labels Apr 1, 2021
@connor4312
Copy link
Member

connor4312 commented Apr 1, 2021

This seems to affect all remote browser debugging in WSL (see linked issue), marking as candidate for recovery

connor4312 added a commit to microsoft/vscode-js-debug that referenced this issue Apr 1, 2021
@connor4312
Copy link
Member

connor4312 commented Apr 1, 2021

For other users running into this: the fix will be available in the nightly and on Insiders after this evening.

@nicojs
Copy link

nicojs commented Apr 2, 2021

Thanks @connor4312! I can confirm that switching to nightly just now fixed it 🎉. You deserve a medal 🥇

@dpvball
Copy link

dpvball commented Apr 2, 2021

it fixed it for me as well. Thanks @connor4312

one thing to note, it was giving me a connection error still with my launch.json using legacy attach for chrome which was working before. I changed it to the following and everything works as expected again
"type": "pwa-chrome",

@connor4312
Copy link
Member

This will be in the upcoming recovery build

@connor4312 connor4312 changed the title ECONNREFUSED debugging browsers in remotes ECONNREFUSED debugging browsers in WSL2 Apr 5, 2021
@connor4312
Copy link
Member

@joaomoreno please verify if you can 🙂

@bartcorremans
Copy link

bartcorremans commented Apr 6, 2021

This fix works inconsistently for me. I have to try a couple of times to get the debugger to attach to Chrome properly, it seems very random.

This is my launch.json:

{
    "version": "0.2.0",
    "configurations": [
        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:4200",
            "webRoot": "${workspaceFolder}"
        }
    ]
}

I don't see anything special in the Extension Host console. Is there any other info I can provide?

@connor4312
Copy link
Member

Can you share a gif of what you see? https://gifcap.dev/ is helpful

@bartcorremans
Copy link

Sure thing.

recording

When it does work, the url in Chrome switches from about:blank to http://localhost:4200 within a second or so. Otherwise, the above is what I get.

@connor4312
Copy link
Member

Hm, okay. I don't get that from here and it seems like the fix worked for others... Can you add trace: true to the launch.json and share the resulting log file? Its location will be printed in the debug console. That might have some additional information for me to see what's going on.

@bartcorremans
Copy link

@rzhao271 rzhao271 added the author-verification-requested Issues potentially verifiable by issue author label Apr 7, 2021
@joaomoreno joaomoreno added the verified Verification succeeded label Apr 8, 2021
@Olivloliv
Copy link

I experience the same issue, but it just never works, I always have the error message. I can't unzip the resulting trace file, but if it might be useful...
vscode-debugadapter-da47e36d.json.gz

@cool-delete
Copy link

I experience the same issue, but it just never works, I always have the error message.
my wsl port is set from 50000 to 60000
so I keep seeing that it will definitely fail to start
image
@connor4312

@connor4312
Copy link
Member

@Olivloliv you are not running the version of the debugger with the fix, please see here #120227 (comment)

@cool-delete please confirm that you're running the correct version of the debugger

@cool-delete
Copy link

yes thanks this fix my problem

@Olivloliv
Copy link

Oups my bad, it does fix it as well ! thanks

@Agamennon
Copy link

Agamennon commented Apr 9, 2021

@connor4312 Please re-open as the new update broke this again (insider 1.56.0) javascript debugger (v2021.4.717)

@Agamennon
Copy link

reverting to javascript debugger 1.56.0, this version is working fine.

@connor4312
Copy link
Member

@Agamennon please capture a trace log by setting "trace": true in your launch.json

@MikeMcDonald83
Copy link

Still having this problem. Using Insiders 1.56.0, js-debug nightly 2021.4.2017 and Ubuntu 20.04.2 on WSL2. Tried both launch and attach. Tried various ports. I can't unzip the verbose debug log because "Unexpected end of file" with gzip. I'll attach anyways. If there's a way to print a verbose log without compression I will do so.

launch.json for this attempt:
"version": "0.2.0", "configurations": [ { "type": "pwa-chrome", "request": "launch", "name": "Launch Chrome against localhost", "url": "http://localhost:8081", "webRoot": "${workspaceFolder}", "trace": true } ]

vscode-debugadapter-78f9297a.json.gz

@connor4312
Copy link
Member

@MikeMcDonald83 are there any errors if you open console in the Toggle Developer Tools command?

@MikeMcDonald83
Copy link

MikeMcDonald83 commented Apr 21, 2021

@connor4312 Yes. This was from 2 attempts using the same settings as before.

image

Edit2:
Attach and Launch are both working locally with Live Server. In WSL, Attach works if I manually start Chrome with --remote-debugging-port=9222. The only thing not working is the "Launch against localhost" config in the WSL environment. ECONNREFUSED pops up and a new Chrome window opens to about:blank for a couple seconds before timing out. I've tried several ports.

@mellester
Copy link

mellester commented Apr 26, 2021

vscode-debugadapter-db300a49.json.gz
I still have the same problem
image
image

        {
            "type": "pwa-chrome",
            "request": "launch",
            "name": "Launch Chrome against localhost",
            "url": "http://localhost:3000",
            "sourceMaps": true,
            "trace": true,
            "webRoot": "${workspaceFolder}"
        }

I hope this is enough information,

@Agamennon
Copy link

Unfortunately Javascript debugger 1.56.1 broke this again, nightly is also broken, there is no working javascript debugger now working with WSL , last working version was 1.56.0,

@connor4312
Copy link
Member

@Agamennon please open an issue here with the instructions on the template https://github.com/microsoft/vscode-js-debug/issues

@connor4312
Copy link
Member

connor4312 commented Apr 30, 2021

fyi (for others who commented on this thread) I believe I've found the issue, see microsoft/vscode-js-debug#982 (comment)

@github-actions github-actions bot locked and limited conversation to collaborators May 20, 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 candidate Issue identified as probable candidate for fixing in the next release debug Debug viewlet, configurations, breakpoints, adapter issues verified Verification succeeded
Projects
None yet
Development

No branches or pull requests