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

Extension is not deactivated during an extension upgrade #537

Closed
joaomoreno opened this issue Nov 24, 2015 · 15 comments
Closed

Extension is not deactivated during an extension upgrade #537

joaomoreno opened this issue Nov 24, 2015 · 15 comments
Labels
feature-request Request for new features or functionality install-update VS Code installation and upgrade system issues
Milestone

Comments

@joaomoreno
Copy link
Member

We need to support extension deactivation. Primary use cases will be uninstallation and update.

Users are already hitting issues due to it:

So I and another user had an issue while trying to update an already-installed extension. If you go into “Install Extensions” and select the new version of the PowerShell extension, it tries to install but fails halfway through. If you reopen code, the plugin host starts crashing. You end up having to delete the extension folder manually before you can install the update.

I think this may be due to the fact that I’m running my language server process from inside of the extension folder. If the process is running, it seems to block the successful reinstall of the extension. Seems like we may need some way to kill the running extension before attempting to update it.

@daviwil

@egamma
Copy link
Member

egamma commented Nov 24, 2015

see also microsoft/vscode-go#26

@gep13
Copy link
Contributor

gep13 commented Nov 24, 2015

@joaomoreno do we need a separate issue to track this requirement:

https://twitter.com/jchannon/status/667283133318889472

i.e. to get a notification about available updates for extensions?

@daviwil
Copy link
Contributor

daviwil commented Nov 24, 2015

There is one:

#268

@gep13
Copy link
Contributor

gep13 commented Nov 24, 2015

@daviwil said...
There is one:

Ah, perfect 👍

@alexdima alexdima added the bug Issue identified by VS Code Team member as probable bug label Nov 25, 2015
@egamma egamma mentioned this issue Dec 9, 2015
34 tasks
@alexdima
Copy link
Member

alexdima commented Dec 9, 2015

With 98473e0, VSCode's extension host will now call deactivate() if extensions export it and call dispose() on ExtensionContext.subscriptions on shutdown, then will wait 1s before exiting

@alexdima alexdima closed this as completed Dec 9, 2015
@alexdima alexdima added this to the Dec 2015 milestone Dec 9, 2015
@jrieken jrieken added the verified Verification succeeded label Dec 16, 2015
@daviwil
Copy link
Contributor

daviwil commented Dec 17, 2015

The PowerShell extension has added a deactivate() method but I don't see it getting called when attempting to upgrade my extension in 0.10.4. With PowerShell@0.3.0 installed, I attempted to upgrade to PowerShell@0.3.1 and didn't see my language server get a shutdown request (which should be caused by the deactivate method).

Here's my main.ts file's deactivate method:

https://github.com/PowerShell/vscode-powershell/blob/master/src/main.ts#L106

Did I implement this incorrectly? Should I instead create a disposable that calls the necessary shutdown method?

Thanks!

@daviwil
Copy link
Contributor

daviwil commented Dec 17, 2015

cc @dbaeumer since I'm using vscode-languageclient

@egamma
Copy link
Member

egamma commented Dec 17, 2015

adding @alexandrudima

@egamma
Copy link
Member

egamma commented Dec 18, 2015

@daviwil your implementation looks fine

I don't see it getting called when attempting to upgrade my extension in 0.10.4

Currently deactivate is only called when VS Code exits, it isn't called when you upgrade/reload.
Can you verify that deactivate is called when you shutdown Code.

@daviwil
Copy link
Contributor

daviwil commented Dec 18, 2015

Yep, it definitely gets called during shutdown and also when I open a different workspace path. For me, the extension upgrade scenario was the biggest problem that deactivate would solve because the upgrade doesn't succeed while my language server process is still running (it's in the extension folder). Can this method be called at extension upgrade time too?

To clarify, my extension should be deactivated before the extension upgrade process starts.

@egamma egamma added feature-request Request for new features or functionality and removed api bug Issue identified by VS Code Team member as probable bug verified Verification succeeded labels Dec 18, 2015
@egamma egamma modified the milestones: Backlog, Dec 2015 Dec 18, 2015
@egamma egamma added the install-update VS Code installation and upgrade system issues label Dec 18, 2015
@egamma egamma changed the title Support extension deactivation Extension is not deactivated during an extension upgrade Dec 18, 2015
@egamma egamma added bug Issue identified by VS Code Team member as probable bug and removed feature-request Request for new features or functionality labels Dec 18, 2015
@egamma
Copy link
Member

egamma commented Dec 18, 2015

Issue #567 tracks the deactivate on shutdown scenario.
Reopening this issue to track deactivate during an extension upgrade.

@egamma egamma reopened this Dec 18, 2015
@egamma
Copy link
Member

egamma commented Jan 5, 2016

@daviwil the December update improved the way an extension is updated. The update is now installed into a new folder with the version suffix.

Can you please verify whether this support addresse the issues with PowerShell/vscode-powershell#27.

@daviwil
Copy link
Contributor

daviwil commented Jan 5, 2016

Yep, I noticed the new folder layout, that is an improvement! One question about the new behavior - after you download and unpack the extension into the new version-specific folder, do you attempt to delete the older verson's extension folder? If so, does it happen before or after VS Code restarts? The only way we would still have a problem is if VS Code attempts to delete the old extension folder before it restarts because my language server process would still be running at this point.

@joaomoreno
Copy link
Member Author

@daviwil Deletion will only happen after VS Code restarts.

@daviwil
Copy link
Contributor

daviwil commented Jan 5, 2016

Perfect! I'll be releasing a new update to my extension in the next week or two, so I'll let you know if I see any issues when attempting an upgrade at that time. Feel free to close this issue for now, I'm pretty confident that your changes will have fixed it.

@egamma egamma mentioned this issue Jan 6, 2016
59 tasks
@joaomoreno joaomoreno added feature-request Request for new features or functionality and removed bug Issue identified by VS Code Team member as probable bug labels Sep 2, 2016
@vscodebot vscodebot bot locked and limited conversation to collaborators Nov 18, 2017
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
feature-request Request for new features or functionality install-update VS Code installation and upgrade system issues
Projects
None yet
Development

No branches or pull requests

6 participants