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

Crashing worker in web extension host brings down the entire extension host #129194

Closed
mjbvz opened this issue Jul 22, 2021 · 1 comment
Closed
Assignees
Labels
insiders-released Patch has been released in VS Code Insiders
Milestone

Comments

@mjbvz
Copy link
Collaborator

mjbvz commented Jul 22, 2021

Steps to Reproduce:

  1. yo code --insiders and create a web extension
  2. In the main extension.ts, spawn a worker:
declare const Worker: any;

export function activate(context: vscode.ExtensionContext) {
    const workWorkWork = new Worker(vscode.Uri.joinPath(context.extensionUri, 'crashy-worker.js'));
}
  1. Create crashy-worker.js at the top level of the extension:
throw new Error('Worker error') 
  1. F5 and then activate the extension

Bug
The worker exception brings down the entire extension host. While debugging with F5, this causes the entire window to close without any useful error logs

@jrieken jrieken added this to the August 2021 milestone Aug 16, 2021
@jrieken
Copy link
Member

jrieken commented Aug 18, 2021

Something similar happens even without a dedicated worker, e.g have the snippet below and see the extension host terminate

vscode.commands.registerCommand('web-ext.helloWorld', () => {
	setTimeout(() => { throw new Error('RANDOM'); });
	console.log('WAIT for it');
});

This is because the onerror-handler is very strict simply triggers an exit, see

(event: any) => {
console.error(event.message, event.error);
this._onDidExit.fire([ExtensionHostExitCode.UnexpectedError, event.message || event.error]);
}

I will push a change to only terminate the web extension host when uncaught errors happen during worker-start

@github-actions github-actions bot locked and limited conversation to collaborators Oct 2, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
insiders-released Patch has been released in VS Code Insiders
Projects
None yet
Development

No branches or pull requests

4 participants
@jrieken @alexdima @mjbvz and others