-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
gracefully terminate plugin host process without rpc connection #7192
gracefully terminate plugin host process without rpc connection #7192
Conversation
@kittaakos Could you check please whether you can reproduce #7113 with it? |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM,
I have tested with the typescript extension by creating a very large file with lots of errors and reloading after applying changes and hitting content assist. Did that multiple times. The LS always reconnected and worked properly. In the terminal I saw no messages about unknown actors or closed connections and no dangling processes.
I still get the errors about the missing registerSelectionRangeProvider
, which I guess is expected and not part of this PR. Also old node processes are shown as in ps
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have verified it locally in electron with the vscode-go
, vscode-yaml
, and TS LS.
- Error: kill ESRCH when starting, restarting frontend app with the go and yaml VS Code LS extension #7113 is OK ✅
- Error:
Unknown actor YourServiceName
when refreshing the browser window #7176 is OK ✅
Besides the Possible Emitter memory leak detected
warnings when opening a JS file from the node_modules
(also logged here), I do not see any errors in the log. Very nice 👍Thank you!
root ERROR [hosted-plugin: 38386] Error: Possible Emitter memory leak detected. 31 listeners added. Use event.maxListeners to increase the limit (30)
at Emitter.checkMaxListeners (/Users/akos.kitta/git/theia/packages/core/lib/common/event.js:253:26)
at PreferenceRegistryExtImpl._event.Object.assign.maxListeners [as onDidChangeConfiguration] (/Users/akos.kitta/git/theia/packages/core/lib/common/event.js:221:27)
at Object.onDidChangeConfiguration (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-context.js:387:46)
at w.start (/Users/akos.kitta/git/theia/plugins/vscode-builtin-jake/extension/dist/main.js:1:4299)
at t.activate (/Users/akos.kitta/git/theia/plugins/vscode-builtin-jake/extension/dist/main.js:1:6063)
at PluginManagerExtImpl.<anonymous> (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:548:87)
at step (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:47:23)
at Object.next (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:28:53)
at fulfilled (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:19:58)
root INFO [hosted-plugin: 38386] PLUGIN_HOST(38386): PluginManagerExtImpl/loadPlugin(/Users/akos.kitta/git/theia/plugins/vscode-builtin-gulp/extension/dist/main)
root ERROR [hosted-plugin: 38386] Error: Possible Emitter memory leak detected. 32 listeners added. Use event.maxListeners to increase the limit (30)
at Emitter.checkMaxListeners (/Users/akos.kitta/git/theia/packages/core/lib/common/event.js:253:26)
at PreferenceRegistryExtImpl._event.Object.assign.maxListeners [as onDidChangeConfiguration] (/Users/akos.kitta/git/theia/packages/core/lib/common/event.js:221:27)
at Object.onDidChangeConfiguration (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-context.js:387:46)
at b.start (/Users/akos.kitta/git/theia/plugins/vscode-builtin-gulp/extension/dist/main.js:1:4494)
at t.activate (/Users/akos.kitta/git/theia/plugins/vscode-builtin-gulp/extension/dist/main.js:1:6258)
at PluginManagerExtImpl.<anonymous> (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:548:87)
at step (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:47:23)
at Object.next (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:28:53)
at fulfilled (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:19:58)
root INFO [hosted-plugin: 38386] PLUGIN_HOST(38386): PluginManagerExtImpl/loadPlugin(/Users/akos.kitta/git/theia/plugins/vscode-builtin-grunt/extension/dist/main)
root ERROR [hosted-plugin: 38386] Error: Possible Emitter memory leak detected. 33 listeners added. Use event.maxListeners to increase the limit (30)
at Emitter.checkMaxListeners (/Users/akos.kitta/git/theia/packages/core/lib/common/event.js:253:26)
at PreferenceRegistryExtImpl._event.Object.assign.maxListeners [as onDidChangeConfiguration] (/Users/akos.kitta/git/theia/packages/core/lib/common/event.js:221:27)
at Object.onDidChangeConfiguration (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-context.js:387:46)
at w.start (/Users/akos.kitta/git/theia/plugins/vscode-builtin-grunt/extension/dist/main.js:1:4718)
at t.activate (/Users/akos.kitta/git/theia/plugins/vscode-builtin-grunt/extension/dist/main.js:1:6483)
at PluginManagerExtImpl.<anonymous> (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:548:87)
at step (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:47:23)
at Object.next (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:28:53)
at fulfilled (/Users/akos.kitta/git/theia/packages/plugin-ext/lib/plugin/plugin-manager.js:19:58)
looks very nice 👍 |
@benoitf thanks! I will update the PR and ping you again |
@benoitf About configurable timeouts, env variables and cli options should work? i.e. users for them are adopters, not end users. It is not feasible to configure it via preferences since the user session is not always available (i.e. during page reload we cannot read them) and I'm not sure that it is desirable to give control over them to end users. |
@akosyakov yes sure I was more thinking a setting of the product (not user preferences) |
…ction Signed-off-by: Anton Kosyakov <anton.kosyakov@typefox.io>
ad70c71
to
d2a7f4f
Compare
@benoitf I've pushed again:
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks @akosyakov . I may be able to test only this afternoon but I've no objections if it's merged before.
@benoitf I will merge on Monday |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍 tested with several browser windows, all processes are properly killed after refreshing/closing all tabs
What it does
fix #7176, fix #5019, fix #5839, fix #6677, fix #7113
The issue arises when there are pending requests in the plugin host process and the main side is already gone (which is basically always on reload). For some reasons we create a new RPC protocol which is not capable of handling such pending requests to stop plugins.
Instead of creating new protocol this PR adds new control messages:
It fixes the issue with massive amount of error logging produced on each reload, around 2K lines.
For instance, I checked Gitpod logs for last 7 days and first 3 of 5 most frequent errors are incarnation of this issue.
It as well improves stopping of plugins, since deactivation of VS Code extension can happen asynchronous, but we were not handling it.
In addition, now the plugin host process has a chance to kill child processes on its own (by disposing RPCProtocol) without relying on Theia backend.
How to test
ps -auxf
on linux.Review checklist
Reminder for reviewers