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

Plugin as sidecar initialization fails when browser is refreshed #3970

Closed
tolusha opened this issue Jan 8, 2019 · 8 comments
Closed

Plugin as sidecar initialization fails when browser is refreshed #3970

tolusha opened this issue Jan 8, 2019 · 8 comments
Assignees
Labels
bug bugs found in the application plug-in system issues related to the plug-in system

Comments

@tolusha
Copy link
Contributor

tolusha commented Jan 8, 2019

Plugin (run as side car) initialization fails when browser is refreshed.

How to reproduce

  • Che 7 workspace with plugin providing command contribution
  • Refresh browser
  • Observe stack trace in dev console and plugin doesn't work
Error: Command C_Cpp.ConfigurationSelect already exist
    at CommandRegistryImpl.registerCommand (/home/theia/node_modules/@theia/plugin-ext/lib/plugin/command-registry.js:33:19)
    at Object.registerCommand (/home/theia/node_modules/@theia/plugin-ext/lib/plugin/plugin-context.js:101:40)
    at /home/theia/node_modules/@theia/plugin-ext-vscode/lib/node/plugin-vscode-init.js:37:29
    at Array.forEach (<anonymous>)
    at Object.exports.doInitialization (/home/theia/node_modules/@theia/plugin-ext-vscode/lib/node/plugin-vscode-init.js:29:30)
    at Function.PluginHostRPC.initialize (/home/theia/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host-rpc.js:54:25)
    at Object.init (/home/theia/node_modules/@theia/plugin-ext/lib/hosted/node/plugin-host-rpc.js:95:43)
    at PluginManagerExtImpl.$init (/home/theia/node_modules/@theia/plugin-ext/lib/plugin/plugin-manager.js:85:35)
    at RPCProtocolImpl.doInvokeHandler (/home/theia/node_modules/@theia/plugin-ext/lib/api/rpc-protocol.js:173:23)
    at RPCProtocolImpl.invokeHandler (/home/theia/node_modules/@theia/plugin-ext/lib/api/rpc-protocol.js:158:41)
@tolusha tolusha added bug bugs found in the application plug-in system issues related to the plug-in system labels Jan 8, 2019
@tolusha tolusha self-assigned this Jan 9, 2019
@tolusha tolusha added Team: Che-Languages issues regarding the che-languages team commands issues related to application commands labels Jan 9, 2019
@tolusha
Copy link
Contributor Author

tolusha commented Jan 10, 2019

/cc @benoitf @evidolob
PluginManagerExtImpl.$init() is invoked every time when browser is refreshed.

@tolusha
Copy link
Contributor Author

tolusha commented Jan 10, 2019

It seems there is no quick fix regarding the root of the issue.
For the time being I propose a workaround:

        if (this.commands.has(command.id)) {
            throw new Error(`Command ${command.id} already exist`);
        }

====>

       if (this.commands.has(command.id)) {
            this.commands.delete(command.id);
            this.proxy.$unregisterCommand(command.id);
            console.warn(`Command ${command.id} already exist and is overridden.`);
        }

Another solution is to postpone until we have a clear vision.

@benoitf
Copy link
Contributor

benoitf commented Jan 10, 2019

AFAIK plug-in is being stopped on refresh as well so cleanup of commands should be done at that time (so when it starts again it's not there)

@tolusha
Copy link
Contributor Author

tolusha commented Jan 10, 2019

Make sense, I will check

@tolusha tolusha removed the commands issues related to application commands label Jan 10, 2019
@tsmaeder tsmaeder removed the Team: Che-Languages issues regarding the che-languages team label Jan 17, 2019
@tsmaeder
Copy link
Contributor

This is more for the IDE2 team. @evidolob Not a clue what the right approach is here.

@azatsarynnyy
Copy link
Member

There's the same issue with the Kubernetes Tooling Plugin.
Running it against Che Theia with Anatoliy's patch fixes the problem.

@benoitf
Copy link
Contributor

benoitf commented Mar 15, 2019

should be fixed now with latest fix #4583

@azatsarynnyy
Copy link
Member

@benoitf I've tested it with the K8s Plugin. Works well. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug bugs found in the application plug-in system issues related to the plug-in system
Projects
None yet
Development

No branches or pull requests

4 participants