Undefined Index in API.php (API.get) running archive from command line


#1

Below is the only error I received. I am having trouble deciphering it. Any help is greatly appreciated!

INFO CoreConsole[2014-05-14 00:32:24] [9cd84] Error: Got invalid response from API request: Piwik › Error&trigger=archivephp. Response was '
There is an error. Please report the message (Piwik 2.2.2) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).

Notice: Undefined index: 2011-08-18 in /var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/API.php on line 493

Backtrace -->

#0 Piwik\Error::errorHandler(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/API.php:493]
#1 Piwik\Plugins\API\API->mergeDataTables(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/API.php:477]
#2 Piwik\Plugins\API\API->get(…) called at [:]
#3 call_user_func_array(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/API/Proxy.php:209]
#4 Piwik\API\Proxy->call(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/API/Request.php:215]
#5 Piwik\API\Request->process(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/Controller.php:31]
#6 Piwik\Plugins\API\Controller->index(…) called at [:]
#7 call_user_func_array(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/FrontController.php:500]
#8 Piwik\FrontController->doDispatch(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/FrontController.php:85]
#9 Piwik\FrontController->dispatch(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/dispatch.php:34]
#10 require_once(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/index.php:47]
#11 require_once(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/CliMulti/RequestCommand.php:55]
#12 Piwik\CliMulti\RequestCommand->execute(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241]
#13 Symfony\Component\Console\Command\Command->run(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:895]
#14 Symfony\Component\Console\Application->doRunCommand(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:191]
#15 Symfony\Component\Console\Application->doRun(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/Console.php:66]
#16 Piwik\Console->doRun(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:121]
#17 Symfony\Component\Console\Application->run(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/console:31]

There is an error. Please report the message (Piwik 2.2.2) and full backtrace in the Piwik forums (please do a Search first as it might have been reported already!).

Notice: Undefined index: 2011-08-18 in /var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/API.php on line 493

Backtrace -->

#0 Piwik\Error::errorHandler(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/API.php:493]
#1 Piwik\Plugins\API\API->mergeDataTables(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/API.php:477]
#2 Piwik\Plugins\API\API->get(…) called at [:]
#3 call_user_func_array(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/API/Proxy.php:209]
#4 Piwik\API\Proxy->call(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/API/Request.php:215]
#5 Piwik\API\Request->process(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/plugins/API/Controller.php:31]
#6 Piwik\Plugins\API\Controller->index(…) called at [:]
#7 call_user_func_array(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/FrontController.php:500]
#8 Piwik\FrontController->doDispatch(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/FrontController.php:85]
#9 Piwik\FrontController->dispatch(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/dispatch.php:34]
#10 require_once(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/index.php:47]
#11 require_once(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/core/CliMulti/RequestCommand.php:55]
#12 Piwik\CliMulti\RequestCommand->execute(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241]
#13 Symfony\Component\Console\Command\Command->run(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:895]
#14 Symfony\Component\Console\Application->doRunCommand(…) called at [/var/www/vhosts/piwik.harrison.neadwerx.com/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:191]
#15


(Matthieu Aubry) #2

Thanks for the report, I created a ticket in our issue tracker Notice: Undefined index: 2011-08-18 in plugins/API/API.php on line 493 · Issue #5168 · matomo-org/matomo · GitHub


#3

I am suffering from the same issue:

#0 Piwik\Error::errorHandler(…) called at [/var/www/vhosts/piwik/plugins/API/API.php:493]
#1 Piwik\Plugins\API\API->mergeDataTables(…) called at [/var/www/vhosts/piwik/plugins/API/API.php:477]
#2 Piwik\Plugins\API\API->get(…) called at [:]
#3 call_user_func_array(…) called at [/var/www/vhosts/piwik/core/API/Proxy.php:209]
#4 Piwik\API\Proxy->call(…) called at [/var/www/vhosts/piwik/core/API/Request.php:215]
#5 Piwik\API\Request->process(…) called at [/var/www/vhosts/piwik/plugins/API/Controller.php:31]
#6 Piwik\Plugins\API\Controller->index(…) called at [:]
#7 call_user_func_array(…) called at [/var/www/vhosts/piwik/core/FrontController.php:500]
#8 Piwik\FrontController->doDispatch(…) called at [/var/www/vhosts/piwik/core/FrontController.php:85]
#9 Piwik\FrontController->dispatch(…) called at [/var/www/vhosts/piwik/core/dispatch.php:34]
#10 require_once(…) called at [/var/www/vhosts/piwik/index.php:47]
#11 require_once(…) called at [/var/www/vhosts/piwik/core/CliMulti/RequestCommand.php:53]
#12 Piwik\CliMulti\RequestCommand->execute(…) called at [/var/www/vhosts/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:241]
#13 Symfony\Component\Console\Command\Command->run(…) called at [/var/www/vhosts/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:895]
#14 Symfony\Component\Console\Application->doRunCommand(…) called at [/var/www/vhosts/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:191]
#15 Symfony\Component\Console\Application->doRun(…) called at [/var/www/vhosts/piwik/core/Console.php:66]
#16 Piwik\Console->doRun(…) called at [/var/www/vhosts/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:121]
#17 Symfony\Component\Console\Application->run(…) called at [/var/www/vhosts/piwik/console:31]


(Matthieu Aubry) #4

Thanks for report. I increased priority of ticket, we’ll have it fixed for next release!


#5

Hey,

I seem have the same problem on 2.4.0. When re-processing reports after dropping all archive tables, and then executing


./console core:archive --force-all-websites --force-all-periods=315576000 --force-date-last-n=1000 --url=http://10.31.31.2/piwik/

I got:


Notice: Undefined index: 2011-10-15 in /srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/plugins/API/API.php on line 494 

Backtrace -->

#0 Piwik\Error::errorHandler(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/plugins/API/API.php:494]
#1 Piwik\Plugins\API\API->mergeDataTables(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/plugins/API/API.php:478]
#2 Piwik\Plugins\API\API->get(...) called at [:]
#3 call_user_func_array(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/core/API/Proxy.php:209]
#4 Piwik\API\Proxy->call(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/core/API/Request.php:215]
#5 Piwik\API\Request->process(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/plugins/API/Controller.php:31]
#6 Piwik\Plugins\API\Controller->index(...) called at [:]
#7 call_user_func_array(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/core/FrontController.php:507]
#8 Piwik\FrontController->doDispatch(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/core/FrontController.php:84]
#9 Piwik\FrontController->dispatch(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/core/dispatch.php:34]
#10 require_once(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/index.php:47]
#11 require_once(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/core/CliMulti/RequestCommand.php:53]
#12 Piwik\CliMulti\RequestCommand->execute(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:252]
#13 Symfony\Component\Console\Command\Command->run(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/vendor/symfony/console/Symfony/Component/Console/Application.php:887]
#14 Symfony\Component\Console\Application->doRunCommand(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/vendor/symfony/console/Symfony/Component/Console/Application.php:193]
#15 Symfony\Component\Console\Application->doRun(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/core/Console.php:64]
#16 Piwik\Console->doRun(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/vendor/symfony/console/Symfony/Component/Console/Application.php:124]
#17 Symfony\Component\Console\Application->run(...) called at [/srv/app/piwik-2.4.0_RELEASE_2014-07-10_12.16.49.41487/console:31]

and immediately after that (same timestamp), the output/log from console reads:


INFO CoreConsole[2014-07-11 07:49:27] [665c9] Archived website id = 1, period = day, 29081785 visits in last last1000 days, 123811 visits today, Time elapsed: 69805.516s
ERROR CoreConsole[2014-07-11 07:49:27] [665c9] SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
ERROR CoreConsole[2014-07-11 07:49:27] [665c9] SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

And I seem to have daily (but no weekly, monthly, yearly) statistics available in piwik, apparently for all segments that were in working order (some accidentally use outdated query paramters like refererUrl)

It’s a large-ish database (40G on disk), and currently, we have ±10 000 000 PIs every month. But it doesn’t look like mysql actually had a problem. It took roughly a day to get to this point, so now I’ll reduce the number of segments, delete the archives and try again.

Can you give me any hint on how to work around this issue or what may cause it? I’d greatly appreciate any pointers. I saw on github that the demo also referenced a date in 2011 - maybe a workaround could be truncating old data?

cheers,
Philip


(Matthieu Aubry) #6

The bug is still opened: Notice: Undefined index: 2011-08-18 in plugins/API/API.php on line 493 · Issue #5168 · matomo-org/matomo · GitHub

it would be good if you posted a comment there


#7

I did, twice, I may have found a correllation too.


(Matthieu Aubry) #8

Cheers, bug was fixed