Error while sending STMT_PREPARE packet in core:archive

Hi there,

first, a tribute to all the Piwik developers: It’s a great piece of software!

But again and again, I’m struggling with the archive script. I run it directly on the command line for a site with about 300 visits per day. It takes 5 to 10 minutes to process everything, but fails after year-period processing and before range-period processing with a database error:

Warning - Error while sending STMT_PREPARE packet.

The query preceding this warning is:

SELECT option_name, option_value FROM `piwik_option` WHERE option_name LIKE ?

I guess, that error occurs in CronArchive::loadCustomDateRangeToPreProcess(), but I have no idea why. The next thing I get is a fatal “MySQL server has gone away” error.
If I run it for each period separately using --force-periods, it works though.

Did anyone experience a similar problem and has a suggestion to resolve it? Any help is very appreciated! Thanks in advance.

Im running Piwik 2.11, by the way.

Here is the last part of the verbose log of core:archive:


INFO CoreConsole[2015-02-19 14:52:10] Archived website id = 1, period = year, 21534 visits in last last2 years, 14490 visits this year, Time elapsed: 73.307s
DEBUG UsersManager[2015-02-19 14:52:10] Db::fetchAll() executing SQL: SELECT option_name, option_value FROM `piwik_option` WHERE option_name LIKE ?
WARNING UsersManager[2015-02-19 14:52:10] /kunden/larsen-mdm.de/piwik/libs/Zend/Db/Statement/Mysqli.php(70): Warning - Error while sending STMT_PREPARE packet. PID=8974 - Piwik 2.11.0 - Please report this message in the Piwik forums: http://forum.piwik.org (please do a search first as it might have been reported already)
DEBUG SitesManager[2015-02-19 14:52:10] Db::fetchAll() executing SQL: SELECT idsite FROM piwik_site
ERROR CoreConsole[2015-02-19 14:52:10] Mysqli prepare error: MySQL server has gone away



  [Exception]
  Mysqli prepare error: MySQL server has gone away



Exception trace:
 () at /kunden/larsen-mdm.de/piwik/core/CronArchive.php:406
 Piwik\CronArchive->logFatalError() at /kunden/larsen-mdm.de/piwik/plugins/CoreConsole/Commands/CoreArchiver.php:43
 Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute() at /kunden/larsen-mdm.de/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php:253
 Symfony\Component\Console\Command\Command->run() at /kunden/larsen-mdm.de/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:874
 Symfony\Component\Console\Application->doRunCommand() at /kunden/larsen-mdm.de/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:195
 Symfony\Component\Console\Application->doRun() at n/a:n/a
 call_user_func() at /kunden/larsen-mdm.de/piwik/core/Console.php:58
 Piwik\Console->Piwik\{closure}() at /kunden/larsen-mdm.de/piwik/core/Access.php:454
 Piwik\Access::doAsSuperUser() at /kunden/larsen-mdm.de/piwik/core/Console.php:59
 Piwik\Console->doRun() at /kunden/larsen-mdm.de/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php:126
 Symfony\Component\Console\Application->run() at /kunden/larsen-mdm.de/piwik/console:27

wait_timeout of my MySQL server is 1 hour, max_allowed_packet is 16 M and I’m not allowed to change that value.

Hi there,

I’m not sure how we could solve this bug, but just to make sure we don’t forget, can you create a bug report at: Issues · matomo-org/piwik · GitHub
thanks