mirror of
https://github.com/Microsoft/vscode
synced 2024-08-27 13:00:58 +00:00
Add a watchdog mechanism to detect when the extension host JavaScript event loop is unresponsive (#26445)
This commit is contained in:
parent
3007332134
commit
0a4b9f324a
|
@ -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']))
|
||||
|
|
5
npm-shrinkwrap.json
generated
5
npm-shrinkwrap.json
generated
|
@ -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",
|
||||
|
|
|
@ -35,6 +35,7 @@
|
|||
"keytar": "^4.0.3",
|
||||
"minimist": "1.2.0",
|
||||
"native-keymap": "1.2.4",
|
||||
"native-watchdog": "0.1.0",
|
||||
"node-pty": "0.6.9",
|
||||
"nsfw": "1.0.16",
|
||||
"semver": "4.3.6",
|
||||
|
|
10
src/typings/native-watchdog.d.ts
vendored
Normal file
10
src/typings/native-watchdog.d.ts
vendored
Normal file
|
@ -0,0 +1,10 @@
|
|||
/*---------------------------------------------------------------------------------------------
|
||||
* 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> {
|
||||
|
|
Loading…
Reference in a new issue