settings-view icon indicating copy to clipboard operation
settings-view copied to clipboard

Package cards in Updates panel don't change state when updates are done installing

Open mnquintana opened this issue 10 years ago • 32 comments

Just noticed this as of Atom 0.208.0-c06d62e:

  1. Click the Update button in an available update package card in the Updates panel
  2. Wait a sufficiently long time so you know it should've been installed (~5 mins with an SSD, for example)
  3. Package card will still say "Updating..."
  4. Click another panel in Settings View
  5. Close Settings View
  6. Reopen Settings View
  7. Click the Updates panel
  8. Assuming there was only 1 update, it will report that all packages are up-to-date.

Can anyone in @atom/feedback reproduce with the same version?

mnquintana avatar Jun 09 '15 01:06 mnquintana

I also reproduced this with 0.207.0 (both on OS X 10.10.3). The two packages I updated were atom-beautify and git-plus, in case that turns out to be relevant.

mnquintana avatar Jun 09 '15 14:06 mnquintana

I've consistently reproduced this with atom-beautify on every recent update; but, for comparison, the button state changed correctly with minimap.

mnquintana avatar Jun 11 '15 14:06 mnquintana

This has also happened to me. In my case atom-beautify would appear to never finish updating even though it has. When re-opening the update panel it says everything is up to date.

mertzt89 avatar Jun 12 '15 20:06 mertzt89

@benogle Do you think this was fixed by https://github.com/atom/settings-view/pull/572 by any chance?

mnquintana avatar Jul 07 '15 00:07 mnquintana

Maybe. I havent seen this specific issue, though. Was the package disabled? Or in some other state? There were a bunch of issues with disabled packages that I fixed today.

benogle avatar Jul 07 '15 01:07 benogle

Nope, it was in a normal state, but I experienced it very consistently with atom-beautify. I'll see if I get it again now with the changes in master.

mnquintana avatar Jul 07 '15 01:07 mnquintana

Yup, still an issue with atom-beautify :confused:

mnquintana avatar Jul 07 '15 01:07 mnquintana

I think this happens if a package doesn't provide a deactivate method in the version that's being replaced in the update - all of the packages I've been able to reproduce this with have no deactivate method (including atom-beautify).

mnquintana avatar Aug 07 '15 11:08 mnquintana

Figured I should note that the deactivation hook didn't fix this for me in git-plus (https://github.com/akonwi/git-plus/commit/9643e37cdf8a8b8b557f43a3c6b53399e610ab13). The change was introduced in 5.4.3 and I'm updating from 5.4.4 to 5.4.6.

screen shot 2015-08-24 at 3 56 18 pm

jtokoph avatar Aug 24 '15 23:08 jtokoph

still happening

fuzzy76 avatar Nov 03 '15 13:11 fuzzy76

+1

m1r4ge avatar Nov 03 '15 18:11 m1r4ge

Can confirm this too. Just updated 4 packages choosing 'update all'. All packages hang and don't ever reach a "done" status.

gavinworks avatar Nov 09 '15 11:11 gavinworks

I just upgraded from 1.1.0 to 1.2.0 and run the updates; this old issue still exists. I did exactly what @gavinworks did and I'm still waiting to see a "done" status.

stefanos82 avatar Nov 15 '15 23:11 stefanos82

Repros reliably when updating ctrl-dir-scroll (https://atom.io/packages/ctrl-dir-scroll) from 0.2.1 to 0.2.2.

mnquintana wrote:

I think this happens if a package doesn't provide a deactivate method in the version that's being replaced in the update - all of the packages I've been able to reproduce this with have no deactivate method (including atom-beautify).

Adding a couple data points:

  • ctrl-dir-scroll doesn't provide a deactivate method. I checked both the version before the update and after the update.
  • proto-repl does, and this bug doesn't repro when I update that package.

WalterGR avatar Jan 17 '16 01:01 WalterGR

Occurred (most recently) for me in Atom 1.4.0 upgrading atom-beautify, dash, and script, the last of which has had a deactivate method for some time.

duozmo avatar Jan 18 '16 03:01 duozmo

Is there any news on this issue? This is still happening for me with Atom 1.6.2 trying to update Atom-Beautify. Verified on two machines running Windows 10 x64 today. Only way to get Atom's update UI to refresh it's state is to click "Check for Updates" when I can be relatively sure the update has finished.

frankhale avatar Apr 05 '16 17:04 frankhale

I reported the above issue. In my case, the settings-view keeps saying there's an update to atom-beautify 0.29.1. Update through the UI never finishes. APM UPDATE command says there is no update, but according to the repo, there is actually a 0.29.1 version. I have 0.28.28.

Note that deleting the package and re-installing it via apm install still gets me 0.28.28

smlombardi avatar Apr 06 '16 15:04 smlombardi

@mnquintana, referencing your thoughts on packages not having a 'deactivate' method. Atom-Beautify now has one but apparently something else is wrong as the issues keep happening.

frankhale avatar Apr 06 '16 15:04 frankhale

Has anyone looked at the console to verify there was not an error? See https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L438-L443

  update: ->
    return unless @newVersion or @newSha
    @packageManager.update @installablePack ? @pack, @newVersion, (error) =>
      if error?
        version = if @newVersion then "v#{newVersion}" else "##{@newSha.substr(0, 8)}"
        console.error("Updating #{@type} #{@pack.name} to #{version} failed", error.stack ? error, error.stderr)

I do not see where it would update the user interface after the update has been completed.


Quick walkthrough of the flow for updating

It looks like we would want updateInstalledState or displayInstalledState to be called: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L234-L246 updateInstalledState is called by updateInterfaceState at https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L192-L196 updateInerfaceState is called often in handlePackageEvents: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L350-L408 Which uses subscribeToPackageEvent to trigger updating whenever the events are emitted: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L420-L424 The package-manager emits the event package-updated after successfully completing with update call:

  • https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L249-L284
  • emitPackageEvent: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L460-L462

Event package-updated is being properly listened to in the package-card: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-card.coffee#L387 And does call updateInterfaceState as desired. Event package-update-failed is emitted from package-manager when any type of failure occurs: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L266 Which is handled by the same handler in package-card as package-updated event, so updateInterfaceState is called.

At a quick walk through, the code looks to flow properly.


I recommend someone investigates the exit callback within the package-manager: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L274-L290

  • [ ] When does it start (@runCommand below)?
  • [ ] Does it ever end (exit callback is called)?
    • [ ] Yes: If it does end, then is there an error?
      • [ ] Does the Promise.resolve(activation) ever finish?
        • [ ] Does it cause an error? Notice there is not a .catch only a .then: https://github.com/atom/settings-view/blob/40f49b2a0138e5f38bfc9442cdae716ff81bd35a/lib/package-manager.coffee#L282
    • [ ] No: If it does not end, why is @runCommand not calling the exit callback? Is atom-beautify or other packages still being installed/updated with apm install atom-beautify?

Unfortunately, I am not able to look into this issue right now, however if this is still open by the beginning of May I will try to look into it. I hope it is not still open by May though :wink:.

Glavin001 avatar Apr 06 '16 15:04 Glavin001

@Glavin001, I will open the dev tools console on next update to see if any errors are showing.

frankhale avatar Apr 06 '16 15:04 frankhale

I've just run an update of a bunch of packages. I let it run for maybe 20 minutes.

Here is a screenshot of a clean console. The messages you see where there before the update, I probably should have cleared it.

screen shot 2016-04-07 at 1 16 34 pm

You can see that the git-plus update button never changed it's status.

I then reloaded the updates tab and shows fully updated:

screen shot 2016-04-07 at 1 17 11 pm

jtokoph avatar Apr 07 '16 20:04 jtokoph

This always occurs with atom-beautify.

alexchandel avatar Apr 19 '16 05:04 alexchandel

I'm wondering if it has to do with this promise not resolving for packages with activation commands: https://github.com/atom/settings-view/blob/290805efdcb987cd16190859c35e2096c1529bb0/lib/package-manager.coffee#L278

I can also consistently get this issue to happen with atom-beautify:

  1. Run apm install [email protected]
  2. Confirm proper version is installed: apm list | grep atom-beautify
  3. Open atom. Open updates pane. Update atom-beautify.
  4. Update button never goes away even after a long time

jtokoph avatar Apr 19 '16 17:04 jtokoph

Screenshot showing a bit of testing with that promise. I may be misunderstanding how this all works, but the promise never resolves when trying to activate the package. screen shot 2016-04-19 at 10 48 25 am

jtokoph avatar Apr 19 '16 17:04 jtokoph

atom-beautify doesn't activate by default and instead has a few activation commands. Here is a video showing how the activatePackage Promise doesn't resolve until one of the activation commands is used (core-save):

https://www.youtube.com/watch?v=_pKdo4TXOow

jtokoph avatar Apr 19 '16 19:04 jtokoph

@jtokoph So is it a bug that atom-beautify fails to activate, or should the update state depend on something else (perhaps "Loaded", or an entirely new package promise)?

alexchandel avatar Apr 20 '16 01:04 alexchandel

My thoughts are that it can just wait for the loaded promise if it's a regular package (not a theme).

I think this conditional could just be:

activateOnSuccess = theme and atom.packages.isPackageActive(name)

jtokoph avatar Apr 20 '16 03:04 jtokoph

I'm going to test this out tonight and open a pull request if it works well.

jtokoph avatar Apr 20 '16 03:04 jtokoph

For those interested, I opened pull request #771 with a fix if you want to give it a try.

jtokoph avatar Apr 21 '16 17:04 jtokoph

This problem happens for the Hydrogen package too.

edwinksl avatar Jun 16 '16 10:06 edwinksl