Skip to content

Commit

Permalink
fix leaking java debug process
Browse files Browse the repository at this point in the history
When start debugging using vscode java-debug extension,
the debug process will remain in OS process list and
never be killed by theia process if the page is reloaded.

When terminate plugin server, kill all child processes
of plugin-host process.

Signed-off-by: tom-shan <swt0008411@163.com>
  • Loading branch information
tom-shan committed Jul 26, 2019
1 parent f5161db commit d48b272
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions packages/plugin-ext/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
"getmac": "^1.4.6",
"jsonc-parser": "^2.0.2",
"lodash.clonedeep": "^4.5.0",
"tree-kill": "^1.2.1",
"uuid": "^3.2.1",
"vscode-debugprotocol": "^1.32.0"
},
Expand Down
3 changes: 2 additions & 1 deletion packages/plugin-ext/src/hosted/node/hosted-plugin-process.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ import { RPCProtocolImpl } from '../../api/rpc-protocol';
import { MAIN_RPC_CONTEXT } from '../../api/plugin-api';
import { HostedPluginCliContribution } from './hosted-plugin-cli-contribution';
import { HostedPluginProcessesCache } from './hosted-plugin-processes-cache';
const treeKill = require('tree-kill');

export interface IPCConnectionOptions {
readonly serverName: string;
Expand Down Expand Up @@ -129,7 +130,7 @@ export class HostedPluginProcess implements ServerPluginRunner {
const hostedPluginManager = rpc.getProxy(MAIN_RPC_CONTEXT.HOSTED_PLUGIN_MANAGER_EXT);
hostedPluginManager.$stopPlugin('').then(() => {
emitter.dispose();
cp.kill();
treeKill(cp.pid);
});

}
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -9557,6 +9557,11 @@ tree-kill@^1.1.0:
version "1.2.0"
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.0.tgz#5846786237b4239014f05db156b643212d4c6f36"

tree-kill@^1.2.1:
version "1.2.1"
resolved "https://registry.yarnpkg.com/tree-kill/-/tree-kill-1.2.1.tgz#5398f374e2f292b9dcc7b2e71e30a5c3bb6c743a"
integrity sha512-4hjqbObwlh2dLyW4tcz0Ymw0ggoaVDMveUB9w8kFSQScdRLo0gxO9J7WFcUBo+W3C1TLdFIEwNOWebgZZ0RH9Q==

trim-newlines@^1.0.0:
version "1.0.0"
resolved "https://registry.yarnpkg.com/trim-newlines/-/trim-newlines-1.0.0.tgz#5887966bb582a4503a41eb524f7d35011815a613"
Expand Down

0 comments on commit d48b272

Please sign in to comment.