-
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
use decache to unload plugin modules #5760
Conversation
- don't touch exports! - traverse only modules loaded by the plugin, not the entire require cache Signed-off-by: Anton Kosyakov <[email protected]>
@@ -1978,6 +1978,11 @@ caller-id@^0.1.0: | |||
dependencies: | |||
stack-trace "~0.0.7" | |||
|
|||
callsite@^1.0.0: |
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.
@marcdumais-work they are both of MIT license, unfortunately callsite does not have Git repo, but it is MIT in the package.json
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.
Here you go: https://github.com/tj/callsite
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.
Both dependencies look good: MIT licenses and no production dependencies of their own (so no potential that something with inappropriate license would be pulled).
That's also bad that |
@AlexTugarev please review, it is critical to resolve, some vs code extensions don't work |
@akosyakov, how to proceed with @benoitf's use case from #5756 (comment) ? how to test that path? |
@akosyakov is this supposed to fix all errors of the emmet extension? |
@AlexTugarev most important that proposals for emmet extension should not work, let me check whether an error will be gone if we completely remove modules unload I don't know how to proceed with memory leak. There is not issues in Theia. It is Che issue and should be fixed in Che. We cannot test core code against concrete products. It was already mentioned once. |
@akosyakov well, if a plug-in can be stopped/unloaded without restarting browser and that there is a memory leak it's still a theia issue. |
@benoitf Is it possible right now? Could you verify that it does not leak? Could you provide tests? |
I can't but I'm fine to check later (after merged) in upcoming versions and provide fixes if required |
@benoitf thank you, then we proceed with fixing emmet and try to preserve unloading if it is possible |
Sorry for confusion, I've found a real root cause, it is not related to unloading. built-in extensions don't contain node_modules because of npm packaging. It worked for me because i've installed emmet extension from source code at the same time when I've removed a line which deleting exports what got me to wrong conclusions. |
What it does
fix #5756: use decache to unload plugin modules:
How to test
You can verify that modules' exports are not messed up in anyway by:
I don't know how one can verify that there is no memory leak, because UI does not allow to load the same plugin twice in the vanilla Theia and decaching is not required. cc @benoitf
I wonder should decaching belong to this repo at all since it is not used or it should be moved to a corresponding client? cc @svenefftinge
Review checklist
Reminder for reviewers