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

Error while sending STMT_PREPARE packet in range period processing of core:archive #7256

Closed
Callidior opened this issue Feb 20, 2015 · 6 comments
Labels
answered For when a question was asked and we referred to forum or answered it.

Comments

@Callidior
Copy link

I run the core:archive script directly on the command line for a site with about 300 visits per day and more than 30 segments. 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.
This error occurs in Piwik 2.11, but also in earlier versions.

If I run core:archive for each period separately using --force-periods, it works though.

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: [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 MB and I'm not allowed to change that value, but it should be sufficient for the simple query shown above.

@gboddin
Copy link

gboddin commented Mar 19, 2015

I started a proof of concept module allowing the cron archive process to send mysql commands before processing :

https://github.com/gboddin/PiwikMysqlFixTimeout

I don't know if it's related but you could use that method to fix your server settings at the connection time ;)

@Callidior
Copy link
Author

Thanks for this hint, but my wait_timeout already is 1 hour (more than enough). But archiving doesn't work anyway.

@mattab
Copy link
Member

mattab commented Apr 8, 2015

Hi @Callidior please try again with 2.12.1 as we improved performance and memory usage there. also archiving of blobs is much more efficient in 2.13.0-beta which you can download already. You may also need to increase max_allowed_packet

@mattab mattab closed this as completed Apr 8, 2015
@mattab mattab added the answered For when a question was asked and we referred to forum or answered it. label Apr 8, 2015
@Callidior
Copy link
Author

Hi @mattab,
unfortunately, the problem still persists in 2.12.1. I will try 2.13.0 as soon as it is finally released.

@Callidior
Copy link
Author

@mattab The issue still persists in 2.13. Now, it even takes almost 2 hours to process a single website with 43 segments. After that, it fails with the same error message.

@mattab
Copy link
Member

mattab commented May 1, 2015

@Callidior did you try to change your mysql server as explained in this FAQ? http://piwik.org/faq/troubleshooting/faq_183/ it should fix "mysql server has gone away" issue

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
answered For when a question was asked and we referred to forum or answered it.
Projects
None yet
Development

No branches or pull requests

3 participants