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

1.4 update - race conditions #2403

Closed
robocoder opened this issue May 5, 2011 · 8 comments
Closed

1.4 update - race conditions #2403

robocoder opened this issue May 5, 2011 · 8 comments
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Milestone

Comments

@robocoder
Copy link
Contributor

More than one forum user has somehow managed to update to 1.4 without the db update. Setting version_core to 1.3, they were able to trigger it.

@mattab
Copy link
Member

mattab commented May 5, 2011

One case that I am thinking is:

  • Start uploading files
  • in particular core/Version.php is uploaded, but core/Updates/* are not
  • the Live! real time widget refreshes in another tab and causes to trigger ugprade, but there are no Update files yet...
  • DB is set to upgraded
  • then DB upgrade is not triggered once all files are downloaded...

But I'm not sure how we could fix this...
and maybe there are other trigger cases?

@LoloIrie
Copy link

LoloIrie commented May 6, 2011

The build 1.4 (builds.piwik.org) seems to be different as the latest.zip file.

Using the lastest.zip file I'm not able to update Piwik
const VERSION = '1.2.1'; in core/Version.php

Using the build it's fine...
Hope it helps

@robocoder
Copy link
Contributor Author

Lolo Irie: I just downloaded latest.zip, and Version.php says "1.4". It's possible you have a proxy in your network that's caching an older version of latest.zip. Within Piwik, we add a cache buster to the URL, so it'll always get the latest version, which helps should one happen to install an older version.

matt: I think this would be prevented by CoreUpdater_Controller's check for updateCorePlugins=1. This is short-circuited when run from the CLI ... maybe archive.sh triggers the update? (Fix: CLI would also require the updateCorePlugins=1 parameter.)

@robocoder
Copy link
Contributor Author

Oh I see... r3743 bypasses the updateCorePlugins=1 check. So yes, it's possible the Live plugin could have triggered the update before the new scripts in core/Updates/ were uploaded.

In that case, other triggers would include API calls and widgets. I suppose even an anonymous user navigating to the Login form would also trigger the update?

Also, this implies we have a race condition during the one-click update (while files are being copied).

Maybe something like this? (Pseudo-code:)

    if (there are updates)
    {
        if (user is superuser)
        {
            if ((module == 'CoreHome' || module == 'MultiSites')
                and (action is empty || action == 'index'))
            {
                redirect to CoreUpdater
            }
            // else pass through the request
        }
        else if (module != 'Login' && module != 'Proxy')
        {
            Piwik_ExitWithMessage('You must login as superuser to complete the update.');
        }
    }

@mattab
Copy link
Member

mattab commented May 9, 2011

r3743 indeed looks pretty bad now that you highlight it. Maybe we just revert and always show the "Update page" which should really improve the situation?

I agree that asking for super user login might be a good idea, but at the same time it also adds complexity where maybe reverting part of r3743 would fix most issues?

@robocoder
Copy link
Contributor Author

(In [4751]) fixes #2403

@robocoder
Copy link
Contributor Author

(In [4752]) refs #2403 - comment:3

@robocoder
Copy link
Contributor Author

(In [4755]) fixes #2403 - typo

@robocoder robocoder added this to the 1.5 - Piwik 1.5 milestone Jul 8, 2014
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Task Indicates an issue is neither a feature nor a bug and it's purely a "technical" change.
Projects
None yet
Development

No branches or pull requests

3 participants