Skip to content

Commit 35419fc

Browse files
authored
Forcefully kill extension host processes if they still exist (microsoft#196811)
Forcefully kill extension host processes if they still exist (fixes microsoft#194477)
1 parent 871d93a commit 35419fc

File tree

1 file changed

+15
-0
lines changed

1 file changed

+15
-0
lines changed

src/vs/platform/extensions/electron-main/extensionHostStarter.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,21 @@ export class ExtensionHostStarter implements IDisposable, IExtensionHostStarter
7878
extHost.dispose();
7979
this._extHosts.delete(id);
8080
});
81+
82+
// See https://github.com/microsoft/vscode/issues/194477
83+
// We have observed that sometimes the process sends an exit
84+
// event, but does not really exit and is stuck in an endless
85+
// loop. In these cases we kill the process forcefully after
86+
// a certain timeout.
87+
setTimeout(() => {
88+
try {
89+
process.kill(pid, 0); // will throw if the process doesn't exist anymore.
90+
this._logService.error(`Extension host with pid ${pid} still exists, forcefully killing it...`);
91+
process.kill(pid);
92+
} catch (er) {
93+
// ignore, as the process is already gone
94+
}
95+
}, 1000);
8196
});
8297
return { id };
8398
}

0 commit comments

Comments
 (0)