Opened 4 years ago

Closed 3 years ago

Last modified 2 years ago

#1331 closed Bug (wontfix)

Prevent all errors during auto update

Reported by: mburger Owned by: vipsoft
Priority: normal Milestone: Future releases
Component: Core Keywords: wishlist
Cc: Sensitive: no

Description

I just upgraded two Piwik installations from 0.5.5 to 0.6 and ran into the same issue twice. During the upgrade process, a fatal error occurs:

Fatal error: Call to undefined method Piwik::getLoginPluginName() in /some/path/htdocs/core/View.php on line 129

After reloading the URL http://some.host/index.php?module=CoreUpdater&action=oneClickUpdate where that error is shown, I get the message Your Piwik version 0.6 is up to date. However, accessing http://some.host/ afterward redirects to http://some.host/index.php?module=CoreUpdater again where a Database Upgrade is required.

After doing this upgrade, Piwik seems to be updated.

Change History (27)

comment:1 Changed 4 years ago by halfdan

I just got the same error. Additionally I took a look at the SQL that gets executed afterwards:

UPDATE piwik_option SET option_value = "0.6-rc1" WHERE option_name = "version_core";

Doesn't seem right to me as option_value should be set to 0.6 instead of 0.6-rc1..

comment:2 Changed 4 years ago by vipsoft (robocoder)

  • Keywords wishlist added
  • Milestone set to 1 - Piwik 0.7 - DigitalVibes
  • Resolution set to wontfix
  • Status changed from new to closed

halfdan: Under normal situations, Piwik bumps the version number with each each update script applied (core/Updates) and then finally, to the current version number (core/Version.php).

mburger: This error is a side-effect of the auto-update, where an out-of-date file is already loaded in memory but Piwik references new code in the updated file.

AFAIK there is no fix for this (ie to explicitly unload classes from memory). We might (?) be able to mitigate this by:

  • immediately (or soon) after copying the new files to their destination, we force a redirect (ie php closes the session and releases resources)

(That's an oversimplification. The risk here is that the changes to CoreUpdater experiences the same underlying problem as reported in this ticket.)

comment:3 Changed 4 years ago by mburger

I think you should provide a proper warning / error message, at least. Currently, there is no chance I could figure out whether the shown error message indicates a major issue or it is just a cosmetic issue.

Just My 2 Cents...

comment:4 Changed 4 years ago by matt (mattab)

I think the redirect solution might work. After the files are overwritten, we issue 302 redirect to the coreUpdater with a parameter done=1 and it displays the messages. If an error occurs before the files are copied over (or when the files are copied over), we don't redirect.

comment:5 Changed 4 years ago by vipsoft (robocoder)

If we could, then yes, I agree a warning would be nice. In this case, it's a non-catchable fatal error.

comment:6 Changed 4 years ago by vipsoft (robocoder)

  • Milestone changed from Piwik 0.6.1 to 0 - Piwik 0.6.3
  • Resolution wontfix deleted
  • Status changed from closed to reopened

Propose to implement the "redirect" solution.

comment:7 Changed 4 years ago by vipsoft (robocoder)

  • Owner set to vipsoft
  • Status changed from reopened to new

comment:8 Changed 4 years ago by matt (mattab)

  • Milestone changed from 0 - Piwik 0.6.5 to Features requests - after Piwik 1.0

comment:9 Changed 4 years ago by matt (mattab)

  • Resolution set to fixed
  • Status changed from new to closed

comment:10 Changed 4 years ago by matt (mattab)

  • Resolution fixed deleted
  • Status changed from closed to reopened

comment:11 Changed 4 years ago by matt (mattab)

  • Resolution set to wontfix
  • Status changed from reopened to closed

such a small issue, we can implement such change if it happens again in the future.

comment:12 Changed 4 years ago by vipsoft (robocoder)

  • Resolution wontfix deleted
  • Status changed from closed to reopened

Argh. Happened again with 0.8.

Fatal error: Call to undefined function _glob() in /path/to/piwik/core/AssetManager.php on line 371

comment:13 Changed 4 years ago by vipsoft (robocoder)

  • Summary changed from Call to undefined method Piwik::getLoginPluginName() while upgrading from 0.5.5 to 0.6 to Auto-update errors out with "Call to undefined method"

comment:14 Changed 4 years ago by shiki92

And it happened again in 1.0.

Fatal error: Call to undefined method Piwik_Updater::getComponentsWithNewVersion() in /var/www/piwik/plugins/CoreUpdater/CoreUpdater.php on line 61 

comment:15 Changed 4 years ago by vipsoft (robocoder)

  • Milestone changed from Features requests 1.x or 2.x to 1.1 - Piwik 1.1
  • Priority changed from major to normal
  • Status changed from reopened to new

comment:16 Changed 3 years ago by vipsoft (robocoder)

  • Milestone changed from 1.1 - Piwik 1.1 to 1.2 - Piwik 1.2

comment:17 Changed 3 years ago by vipsoft (robocoder)

(In [3398]) refs #1331 - temporary workaround

comment:20 Changed 3 years ago by matt (mattab)

  • Milestone changed from 1.2 - Piwik 1.2 to Feature requests
  • Resolution set to wontfix
  • Status changed from new to closed
  • Summary changed from Auto-update errors out with "Call to undefined method" to Prevent all errors during auto update

The webtest now catches the errors and we will fix them to prevent any bad update experience.

if we want to implement a different update logic, maybe we can look at how wordpress does it for plugins for example.

comment:21 Changed 3 years ago by matt (mattab)

  • Resolution wontfix deleted
  • Status changed from closed to reopened

comment:22 Changed 3 years ago by matt (mattab)

  • Resolution set to wontfix
  • Status changed from reopened to closed

Wont fix for now, since webtest catch all issues and they are easy to fix, but building this 'new feature' is not trivial.

comment:23 Changed 2 years ago by vipsoft (robocoder)

(In [5955]) refs #1713, refs #1331 - workaround for auto-update

comment:24 Changed 2 years ago by vipsoft (robocoder)

(In [5980]) refs #1713, refs #1331 - this should fix the one click update

comment:25 Changed 2 years ago by vipsoft (robocoder)

(In [5988]) refs #1331, refs #3021 - remove #1331 hacks

comment:26 Changed 2 years ago by vipsoft (robocoder)

(In [5991]) fixes #3021, refs #1331 - adds Piwik_View_OneClickDone

During a Piwik software update, there will be instances of old classes
loaded in memory. This is problematic as we will start to instantiate
new classes which may not be backward compatible. This class provides
a clean bridge/transition by forcing a new request.

This class needs to be self-contained, with no external dependencies.

comment:27 Changed 2 years ago by matt (mattab)

Review/questions

  • Did you test auto-updating from 1.7.1 to trunk?
  • Did you test auto-updating from trunk to an imaginative next release?
  • Did you check that errors/warning are reported when there are some?

Thanks!

Note: See TracTickets for help on using tickets.