Skip to content

Commit

Permalink
Forcefully kill extension host processes if they still exist (#196809)
Browse files Browse the repository at this point in the history
Forcefully kill extension host processes if they still exist (fixes #194477)
  • Loading branch information
alexdima authored Oct 27, 2023
1 parent 871d93a commit 846215d
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions src/vs/platform/extensions/electron-main/extensionHostStarter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,21 @@ export class ExtensionHostStarter implements IDisposable, IExtensionHostStarter
extHost.dispose();
this._extHosts.delete(id);
});

// See https://github.com/microsoft/vscode/issues/194477
// We have observed that sometimes the process sends an exit
// event, but does not really exit and is stuck in an endless
// loop. In these cases we kill the process forcefully after
// a certain timeout.
setTimeout(() => {
try {
process.kill(pid, 0); // will throw if the process doesn't exist anymore.
this._logService.error(`Extension host with pid ${pid} still exists, forcefully killing it...`);
process.kill(pid);
} catch (er) {
// ignore, as the process is already gone
}
}, 1000);
});
return { id };
}
Expand Down

0 comments on commit 846215d

Please sign in to comment.