@propertunist opened this Issue on July 24th 2015

after i fixed my API call code for issue: https://github.com/piwik/piwik/issues/8365
all was well.
i then ran the upgrade to 2.14.2 today and my entire site crashed again. i have not looked into this in detail, but i needed to remove the API call to get my site running again.
the errors started after the piwik upgrade process initiated the database upgrade (even though the notes state that this upgrade does not include a database upgrade).

so basically, 8365 went from 'workaround fixed' to 'broken again' - with this upgrade.

@diosmosis commented on July 24th 2015 Member

Please post the error message & stack trace if present.

@propertunist commented on July 24th 2015

this is all i am seeing in the logs -

2015/07/24 19:58:54 [error] 425<a href='/0'>#0</a>: *23 FastCGI sent in stderr: "PHP message: Exception <a href='/1437764133'>#1437764133</a>: exception 'Exception' with message 'Piwik and/or some plugins have been upgraded to a new version. 
--> Please run the update process first. See documentation: http://piwik.org/docs/update/ 
' in /var/www/piwik/plugins/CoreUpdater/CoreUpdater.php:74
Stack trace:
<a href='/0'>#0</a> [internal function]: Piwik\Plugins\CoreUpdater\CoreUpdater->dispatch()
<a href='/1'>#1</a> /var/www/piwik/core/EventDispatcher.php(141): call_user_func_array(Array, Array)
<a href='/2'>#2</a> /var/www/piwik/core/Piwik.php(694): Piwik\EventDispatcher->postEvent('Request.dispatc...', Array, false, NULL)
<a href='/3'>#3</a> /var/www/piwik/core/FrontController.php(284): Piwik\Piwik::postEvent('Request.dispatc...')
<a href='/4'>#4</a> /mysite/functions.php(73): Piwik\FrontController->init()
<a href='/5'>#5</a> /mysite/functions.php(102): piwik_get_country_from_ip()
<a href='/6'>#6</a> /mysite/site.php(171): get_area_code_from_ip_data()
<a href='/7'>#7</a> /mysite/ViewsService.php...
@diosmosis commented on July 24th 2015 Member

It appears you need to upgrade some plugins in your Piwik, can you check if this is the case?

EDIT: If you're currently running the update, and it's taking a long time, can you check if there are update SQL queries running against MySQL?

In this case, to keep your site from failing while the update is going, you should surround your piwik_get_country_from_ip() call w/ a try-catch. Though you may want to remove it after the update so errors aren't silently ignored. Either that or report the error some other way.

@propertunist commented on July 24th 2015

how would i know? i am not seeing any messages to that end in piwik anywhere

@diosmosis commented on July 24th 2015 Member

So Piwik is fine? Can you check the plugin admin page to see if there are any updates for plugins available?

@propertunist commented on July 24th 2015

piwik is fine as long as i don't use the API. there are no notifications for plugin updates on the plugin page.

@diosmosis commented on July 24th 2015 Member

Does the web API fail too or just the code in your website that uses Piwik?

@propertunist commented on July 24th 2015

if i comment out the 'workaround' for 2.14.0:

   if (class_exists('Piwik\Application\Environment'))
        $environment = new \Piwik\Application\Environment('tracker');

in the API call, i then see in the logs:

2015/07/24 21:56:51 [error] 423<a href='/0'>#0</a>: *4274 FastCGI sent in stderr: "PHP message: Exception <a href='/1437771409'>#1437771409</a>: exception 'Piwik\Container\ContainerDoesNotExistException' with message 'The root container has not been created yet.' in /var/www/piwik/core/Container/StaticContainer.php:40

if i leave the workaround in place, the code is as it was prior to the upgrade (which all worked prior to the upgrade) and the pages crash with no entries being made to the log at all.. so i don't have much to add presently.

@diosmosis commented on July 24th 2015 Member

$environment = new \Piwik\Application\Environment('tracker');

This should be new \Piwik\Application\Environment(null), fyi.

Can you tell me if the web API works? Can you visit a URL like http://yourpiwik.com/index.php?module=API&method=API.get&format=XML&idSite=1&period=day&date=2015-06-24,2015-07-23&date=2015-06-24%2C2015-07-23&filter_limit=false&format_metrics=1&expanded=1&filter_limit=30 and see if the same error about an upgrade appears?

@propertunist commented on July 24th 2015

aha! changing 'tracker' to null, appears to have resolved the issue. thanks!

@diosmosis commented on July 24th 2015 Member

That's good, though it's still weird the error you were getting. Re-open if it occurs again.

@propertunist commented on July 24th 2015

ok, will do

@propertunist commented on July 25th 2015

hm, so there are new errors relating to piwik today:

2015/07/25 15:00:22 [error] 423<a href='/0'>#0</a>: *27706 FastCGI sent in stderr: "PHP message: PHP Fatal error:  Uncaught exception 'Zend_Session_Exception' with message 'session has already been started by session.auto-start or session_start()' in /mysite/piwik/libs/Zend/Session.php:451
Stack trace:
<a href='/0'>#0</a> /mysite/piwik/libs/Zend/Session/Namespace.php(143): Zend_Session::start(true)
<a href='/1'>#1</a> /mysite/piwik/core/Session/SessionNamespace.php(34): Zend_Session_Namespace->__construct('CorePluginsAdmi...', false)
<a href='/2'>#2</a> /mysite/piwik/core/Nonce.php(39): Piwik\Session\SessionNamespace->__construct('CorePluginsAdmi...')
<a href='/3'>#3</a> /mysite/piwik/plugins/CorePluginsAdmin/Controller.php(401): Piwik\Nonce::getNonce('CorePluginsAdmi...')
<a href='/4'>#4</a> [internal function]: Piwik\Plugins\CorePluginsAdmin\Controller->safemode(Array)
<a href='/5'>#5</a> /mysite/piwik/core/FrontController.php(494): call_user_func_array(Array, Array)
<a href='/6'>#6</a> /mysite/piwik/core/FrontController.php(94): Piwik\FrontController->doDispatch('CorePluginsAdmi...', 'safemode', Array)
<a href='/7'>#7</a> /mysite/piwik/core/FrontController.php(181): Piwik\FrontController->dispatch('CorePlugins" while reading response header from upstream, client:, server: www.mysite.org, request: "GET /related/3877?offset=60 HTTP/1.1", upstream: "fastcgi://unix:/mysite/php5-fpm.sock:", host: "www.mysite.org"
@propertunist commented on July 25th 2015

this error arises when the same API call is made as before. the error appears to be intermittent, since the error has not occurred in my test site yet.

@diosmosis commented on July 27th 2015 Member

It looks like the session error is actually covering up another error. To see what the error is you could try commenting out the line FrontController::setUpSafeMode(); in core/dispatch.php (this will let the fatal error that's occurring occur naturally).

@propertunist commented on July 28th 2015

ok, i'll do some testing with that line commented. do i look in the php log for the error?

@diosmosis commented on July 28th 2015 Member

The error should appear in HTTP request output (so I would assume your website might display it), and in php/webserver logs.

@propertunist commented on July 28th 2015

ok, i haven't seen any re-occurrences of the error yet - but i'll keep looking

@mattab commented on August 10th 2015 Owner

@propertunist please reopen if you have an issue

This Issue was closed on August 10th 2015
Powered by GitHub Issue Mirror