提交 0a4b9f32 编写于 作者: A Alex Dima

Add a watchdog mechanism to detect when the extension host JavaScript event...

Add a watchdog mechanism to detect when the extension host JavaScript event loop is unresponsive (#26445)
上级 30073321
......@@ -291,6 +291,7 @@ function packageTask(platform, arch, opts) {
.pipe(util.cleanNodeModule('oniguruma', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/*.js']))
.pipe(util.cleanNodeModule('windows-mutex', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('native-keymap', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('native-watchdog', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('jschardet', ['dist/**']))
.pipe(util.cleanNodeModule('windows-foreground-love', ['binding.gyp', 'build/**', 'src/**'], ['**/*.node']))
.pipe(util.cleanNodeModule('gc-signals', ['binding.gyp', 'build/**', 'src/**', 'deps/**'], ['**/*.node', 'src/index.js']))
......
......@@ -295,6 +295,11 @@
"from": "native-keymap@1.2.4",
"resolved": "https://registry.npmjs.org/native-keymap/-/native-keymap-1.2.4.tgz"
},
"native-watchdog": {
"version": "0.1.0",
"from": "native-watchdog@0.1.0",
"resolved": "https://registry.npmjs.org/native-watchdog/-/native-watchdog-0.1.0.tgz"
},
"node-pty": {
"version": "0.6.9",
"from": "node-pty@0.6.9",
......
/*---------------------------------------------------------------------------------------------
* Copyright (c) Microsoft Corporation. All rights reserved.
* Licensed under the MIT License. See License.txt in the project root for license information.
*--------------------------------------------------------------------------------------------*/
declare module 'native-watchdog' {
export function start(timeout: number): void;
}
......@@ -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> {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册