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

Reuires Internet? #3515

Closed
Th3Whit3Wolf opened this issue Mar 8, 2020 · 8 comments · Fixed by #7591
Closed

Reuires Internet? #3515

Th3Whit3Wolf opened this issue Mar 8, 2020 · 8 comments · Fixed by #7591
Labels
A-vscode vscode plugin issues good first issue S-actionable Someone could pick this issue up and work on it right now

Comments

@Th3Whit3Wolf
Copy link

Using the vscode extension (installed from vscode) rust analyzer fails to load. If I connect to wifi I have no problems. However if I connect to wifi open vscode (rust analyzer works correctly at this point) and then disconnect from wifi, close and reopen vscode then I get the same error.

Without looking through the code base I would guess that the extension is looking for a newer version of rust analyzer and when it fails to connect to the internet the entire extension fails.

@Veetaha
Copy link
Contributor

Veetaha commented Mar 8, 2020

Thanks for the report! Might I ask you to show the logs from Help > Toggle Developer Tools > Console?

In general the extension should not fail with the network error right away. Do you see the Download now suggestion in the first place?

@Th3Whit3Wolf
Copy link
Author

Th3Whit3Wolf commented Mar 8, 2020

workbench.desktop.main.js:4051 Overwriting grammar scope name to file mapping for scope source.go.
Old grammar file: file:///usr/lib/code/extensions/go/syntaxes/go.tmLanguage.json.
New grammar file: file:///home/doc/.vscode-oss/extensions/georgewfraser.vscode-tree-sitter-0.1.25/textmate/go.tmLanguage.json
register @ workbench.desktop.main.js:4051
workbench.desktop.main.js:4051 Overwriting grammar scope name to file mapping for scope source.cpp.
Old grammar file: file:///usr/lib/code/extensions/cpp/syntaxes/cpp.tmLanguage.json.
New grammar file: file:///home/doc/.vscode-oss/extensions/georgewfraser.vscode-tree-sitter-0.1.25/textmate/cpp.tmLanguage.json
register @ workbench.desktop.main.js:4051
workbench.desktop.main.js:4051 Overwriting grammar scope name to file mapping for scope source.ruby.
Old grammar file: file:///usr/lib/code/extensions/ruby/syntaxes/ruby.tmLanguage.json.
New grammar file: file:///home/doc/.vscode-oss/extensions/georgewfraser.vscode-tree-sitter-0.1.25/textmate/ruby.tmLanguage.json
register @ workbench.desktop.main.js:4051
workbench.desktop.main.js:4051 Overwriting grammar scope name to file mapping for scope source.rust.
Old grammar file: file:///usr/lib/code/extensions/rust/syntaxes/rust.tmLanguage.json.
New grammar file: file:///home/doc/.vscode-oss/extensions/georgewfraser.vscode-tree-sitter-0.1.25/textmate/rust.tmLanguage.json
register @ workbench.desktop.main.js:4051
workbench.desktop.main.js:4051 Overwriting grammar scope name to file mapping for scope source.ts.
Old grammar file: file:///usr/lib/code/extensions/typescript-basics/syntaxes/TypeScript.tmLanguage.json.
New grammar file: file:///home/doc/.vscode-oss/extensions/georgewfraser.vscode-tree-sitter-0.1.25/textmate/typescript.tmLanguage.json
register @ workbench.desktop.main.js:4051
workbench.desktop.main.js:4051 Overwriting grammar scope name to file mapping for scope source.yaml.
Old grammar file: file:///usr/lib/code/extensions/yaml/syntaxes/yaml.tmLanguage.json.
New grammar file: file:///home/doc/.vscode-oss/extensions/redhat.vscode-yaml-0.7.2/syntaxes/yaml.tmLanguage.json
register @ workbench.desktop.main.js:4051
workbench.desktop.main.js:259 [Extension Host] Activating tree-sitter...
workbench.desktop.main.js:259 [Extension Host] vscode pigments is activated
workbench.desktop.main.js:259 [Extension Host] Looking for parseable documents...
workbench.desktop.main.js:259 [Extension Host] Congratulations, your extension "search-crates-io" is now active!
workbench.desktop.main.js:259 [Extension Host] Found no documents
workbench.desktop.main.js:259 [Extension Host] ApplicationInsights:CorrelationIdManager Array(1)
t.log @ workbench.desktop.main.js:259
marketplace.visualstudio.com/_apis/public/gallery/extensionquery:1 Failed to load resource: net::ERR_NAME_RESOLUTION_FAILED
/usr/lib/code/out/bootstrap-window.js:5 [uncaught exception]: Error: read ECONNRESET
onUnexpectedError @ /usr/lib/code/out/bootstrap-window.js:5
/usr/lib/code/out/bootstrap-window.js:6 Error: read ECONNRESET
    at Pipe.onStreamRead (internal/stream_base_commons.js:183)
onUnexpectedError @ /usr/lib/code/out/bootstrap-window.js:6
events.js:177 Uncaught Error: read ECONNRESET
    at Pipe.onStreamRead (internal/stream_base_commons.js:183)
workbench.desktop.main.js:3482 Extension host terminated unexpectedly. Code:  7  Signal:  null
_onExtensionHostCrashed @ workbench.desktop.main.js:3482
workbench.desktop.main.js:2720 Extension host terminated unexpectedly.
onDidNotificationChange @ workbench.desktop.main.js:2720
workbench.desktop.main.js:3851 Extension Host
workbench.desktop.main.js:3851 /home/doc/.vscode-oss/extensions/georgewfraser.vscode-tree-sitter-0.1.25/node_modules/web-tree-sitter/tree-sitter.js:1(function (exports, require, module, __filename, __dirname) { var Module=void 0!==Module?Module:{};!function(e,t){"function"==typeof define&&define.amd?define([],t):"object"==typeof exports?module.exports=t():window.TreeSitter=t()}(0,function(){var e,t={};for(e in Module)Module.hasOwnProperty(e)&&(t[e]=Module[e]);var r,n,o=[],s=function(e,t){throw t},_=!1,a=!1;_="object"==typeof window,a="function"==typeof importScripts,r="object"==typeof process&&"object"==typeof process.versions&&"string"==typeof process.versions.node,n=!_&&!r&&!a;var u,i,l,d,c="";r?(c=a?require("path").dirname(c)+"/":__dirname+"/",u=function(e,t){return l||(l=require("fs")),d||(d=require("path")),e=d.normalize(e),l.readFileSync(e,t?null:"utf8")},i=function(e){var t=u(e,!0);return t.buffer||(t=new Uint8Array(t)),q(t.buffer),t},process.argv.length>1&&process.argv[1].replace(/\\/g,"/"),o=process.argv.slice(2),"undefined"!=tError: getaddrinfo EAI_AGAIN wakatime-cli.s3-us-west-2.amazonaws.com    at GetAddrInfoReqWrap.onlookup [as oncomplete] (dns.js:60:26)
workbench.desktop.main.js:122 [Violation] Added non-passive event listener to a scroll-blocking 'touchstart' event. Consider marking event handler as 'passive' to make the page more responsive. See https://www.chromestatus.com/feature/5745543795965952
onFirstListenerAdd @ workbench.desktop.main.js:122
_event._event @ workbench.desktop.main.js:115
(anonymous) @ workbench.desktop.main.js:112
onFirstListenerAdd @ workbench.desktop.main.js:112
_event._event @ workbench.desktop.main.js:115
N @ workbench.desktop.main.js:908
createMouseController @ workbench.desktop.main.js:922
H @ workbench.desktop.main.js:920
F @ workbench.desktop.main.js:2472
_createInstance @ workbench.desktop.main.js:1581
createInstance @ workbench.desktop.main.js:1580
createNotificationsList @ workbench.desktop.main.js:2784
show @ workbench.desktop.main.js:2784
addToast @ workbench.desktop.main.js:3726
onDidNotificationChange @ workbench.desktop.main.js:3725
(anonymous) @ workbench.desktop.main.js:3725
fire @ workbench.desktop.main.js:116
addNotification @ workbench.desktop.main.js:2741
warn @ workbench.desktop.main.js:3836
(anonymous) @ workbench.desktop.main.js:1589

The Download now never pops up.

Is it possible for other extensions that might require the internet to bring down the rust-analyzer extension?

@Veetaha
Copy link
Contributor

Veetaha commented Mar 8, 2020

Hmm, this is the tree-sitter extension host that crashed here. I don't see any logs from our side.
We did have a message about something uneven happening with the combination of rust-analyzer and tree-sitter in #3013 (comment). I doubt that one extension host can crash the other one. Anyway, thank you for the logs, I'll try to reproduce this

@Th3Whit3Wolf
Copy link
Author

Thank you for the help! I just moved into a new house and until my ISP's modem/router arrives I am using my phones hotspot for internet otherwise I would have never noticed this.

@Veetaha
Copy link
Contributor

Veetaha commented Mar 8, 2020

I managed to reproduce. I confirm that tree-sitter does call abort() on the lack of internet connection, and this is very weird that rust-analyzer's extension host gets shut down altogether (even though I see that it is activated successfully) because vscode creates a separate process for each extension. I will try to investigate the root cause anyway.

@Veetaha
Copy link
Contributor

Veetaha commented Mar 8, 2020

I guess I've managed to reveal this Santa-Barbara.

I was mistaken about the fact that each extension is allocated in a fresh process. In fact, vscode allocates only one extension host process and all extensions are activated and work within this single process. Thus, if one of the extensions aborts the process all other extensions are shut down altogether.

So why tree-sitter aborts the process? This was fun to debug.

The fun part

To get to the root of the problem you

I guess vscode-liveshare is not open-source so looking through their compiled javascript file you might notice this line of code:

    // Fire and forget. Just validating ExP integration. Don't need to do anything with the value.
    liveshare_core_1.getExpService().isFlightEnabledAsync('firstflight');

This guy calls an async function and doesn't handle any async errors (i.e. network unavailability).
However, in the standard scenario, the error would be just ignored (i.e. vscode would just print a warning to the console).

But it appears that emscripten compiler doesn't tolerate neither unhandled rejections nor uncaught exceptions.

So the rejection (due to network outage) not handled by vscode-liveshare extension triggered the handler from code generated by emscripten for web-tree-sitter bindnings (which are the dependency of vscode-tree-sitter extension) that threw an exception which in turn was not caught and the ultimate uncaughtException handler generated by emscripten rethrew the exception thusly terminating the extension host process.

There are two guilty sides here.
First of all the root culprit is vscode-liveshare which doesn't handle the promise rejection in case of no internet connection.
The second one is emscripten compiler which generates code that aborts the process in case of unhandled promise rejections (though I guess this is not the hard error, because unhandled promise rejections are actually a bad thing and ignoring them is deprecated).
I guess I'll submit a bug report to all the sides of the crime.

@Veetaha
Copy link
Contributor

Veetaha commented Mar 8, 2020

So for the time being, I recommend disabling either vscode-liveshare extension or vscode-tree-sitter...

@Veetaha
Copy link
Contributor

Veetaha commented Mar 21, 2020

The problem of this issue is in unhanledRejections. I think to definitely solve it on our side we need to do the great elimination of all floating Promises and Promises that don't have their onrejected listeners attached. Maybe, even add the no-floating-promises linter rule already.

@matklad I think we may mark this one as good-first-issue if someone would like to mess with our frontend code.

@lnicola lnicola added A-vscode vscode plugin issues good first issue S-actionable Someone could pick this issue up and work on it right now labels Jan 22, 2021
@bors bors bot closed this as completed in ff5ef28 Feb 10, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-vscode vscode plugin issues good first issue S-actionable Someone could pick this issue up and work on it right now
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants