Skip to content
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

Closed
wants to merge 1 commit into from
Closed

Conversation

akosyakov
Copy link
Member

@akosyakov akosyakov commented Jul 19, 2019

What it does

fix #5756: use decache to unload plugin modules:

  • don't touch exports!
  • traverse only modules loaded by the plugin, not the entire require cache

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

  • as an author, I have thoroughly tested my changes and carefully reviewed following the review guidelines

Reminder for reviewers

- 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:
Copy link
Member Author

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

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Contributor

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).

@akosyakov akosyakov requested a review from azatsarynnyy July 19, 2019 15:04
@akosyakov
Copy link
Member Author

That's also bad that PluginHostRPC does not belong to DI context. No way for clients to work it around.

@akosyakov akosyakov added critical critical bugs / problems vscode issues related to VSCode compatibility labels Jul 22, 2019
@akosyakov
Copy link
Member Author

@AlexTugarev please review, it is critical to resolve, some vs code extensions don't work

@AlexTugarev
Copy link
Contributor

@akosyakov, how to proceed with @benoitf's use case from #5756 (comment) ? how to test that path?

@AlexTugarev
Copy link
Contributor

@akosyakov is this supposed to fix all errors of the emmet extension? Error: Cannot find module 'vscode-emmet-helper' is still present.

@akosyakov
Copy link
Member Author

akosyakov commented Jul 22, 2019

@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.

@benoitf
Copy link
Contributor

benoitf commented Jul 22, 2019

@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.

@akosyakov
Copy link
Member Author

akosyakov commented Jul 22, 2019

@benoitf Is it possible right now? Could you verify that it does not leak? Could you provide tests?

@benoitf
Copy link
Contributor

benoitf commented Jul 22, 2019

I can't but I'm fine to check later (after merged) in upcoming versions and provide fixes if required

@akosyakov
Copy link
Member Author

@benoitf thank you, then we proceed with fixing emmet and try to preserve unloading if it is possible

@akosyakov
Copy link
Member Author

akosyakov commented Jul 22, 2019

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.

@akosyakov akosyakov closed this Jul 22, 2019
@akosyakov akosyakov deleted the ak/decachde_plugin branch August 3, 2019 13:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
critical critical bugs / problems vscode issues related to VSCode compatibility
Projects
None yet
Development

Successfully merging this pull request may close these issues.

vscode emmet extension does not work anymore
5 participants