Add a watchdog mechanism to detect when the extension host JavaScript event loop is unresponsive (#26445)

This commit is contained in:
Alex Dima
2017-08-14 12:15:16 +02:00
parent 3007332134
commit 0a4b9f324a
5 changed files with 21 additions and 0 deletions

View File

@@ -17,6 +17,7 @@ import { DiskSearch } from 'vs/workbench/services/search/node/searchService';
import { RemoteTelemetryService } from 'vs/workbench/api/node/extHostTelemetry';
import { IInitData, IEnvironment, IWorkspaceData, MainContext } from 'vs/workbench/api/node/extHost.protocol';
import * as errors from 'vs/base/common/errors';
import * as watchdog from 'native-watchdog';
const nativeExit = process.exit.bind(process);
process.exit = function () {
@@ -51,6 +52,9 @@ export class ExtensionHostMain {
// Error forwarding
const mainThreadErrors = threadService.get(MainContext.MainThreadErrors);
errors.setUnexpectedErrorHandler(err => mainThreadErrors.onUnexpectedExtHostError(errors.transformErrorForSerialization(err)));
// Configure the watchdog to kill our process if the JS event loop is unresponsive for more than 10s
watchdog.start(10000);
}
public start(): TPromise<void> {