SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

Hi,

I receive sometimes when browse Piwik web admin interface : SQLSTATE[HY000]: General error: 2006 MySQL server has gone away.

Does anyone has ever meet this problem ? And cope with it ?

Do you believe that increase Mysql max_allowed_packet value may avoid this problem ?

Thanks in advance for your help

It sounds like your MySql connections are being closed on you.

See if you can increase the (mysql) wait timeout. Archiving can take a bit of time.

This happened sometimes even if archiving has been dones with archive.sh.

You don’t believe that increase Mysql max_allowed_packet value may avoid this problem ?

Thanks for your help

Hello I have the same error message. I made no change in Piwik (except suppressing cookies in firefox, but I have the same problem on chrome, so cookies should not be the problem).

No problem with the stats, but the error message appears when I try to go the pages “Personnel parameters” and “Administration”.

The following page says the solution is to change my.cnf configuration file :
http://piwik.org/faq/troubleshooting/faq_183/
… but I can’t find any my.cnf file.

UPDATE. Problem solved after upgrade to last piwik version … BUT appears again when I suppress all cookies in Firefox. And, yes, the problem appears again in Chrome too ! So the only explanation I can think of is that suppressing cookies in any browser induces a change on the server (or does clearing cookies from one browser clears them in all other browsers too ?) …

Thanks for your help.

Just signed in to say I got the exact same issue.

Piwik is 2.16.5.

Navigating in dashboard and various pages on each site works.
But as soon as I want to go in “Personnel parameters” or “Administration”, I got this error message after a while (mysql server has gone way).

I tried:

  • Using mysqli adapter instead of PDO/SQL
  • Using PHP7 instead of PHP 5.6
  • Increasing wait_timeout / interactive_timeout / connect_timeout at the beginning of SQL session (note: waiting time before error is way higher, and message become “Mysqli prepare error: MySQL server has gone away”)
  • I can’t set max_allowed_packet since I’m on a shared host (OVH mutu)
  • Activated debug log to file, with sql debug but no error message nor anything useful (maybe I missed something in config?)

Anyway, I don’t know what to do anymore… Any help appreciated :slight_smile:
Thanks!

Hello,

Piwik 2.16.1, OVH mutu.

Same issue:
No problem with stats, but the following message appears when I try to go “Personnel parameters” and “Administration”."

Message: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

I run several Piwik installations at an other provider with no issue.

Update:
After updating manually Piwik to 2.16.5 following this tutorial: Update Piwik - Analytics Platform - Matomo

Still same issue… :frowning:

Impossible to apply this solution How do I fix the error "Mysql Server has gone away"? - Analytics Platform - Matomo because of OVH mutu. No my.cnf file.

How to solve it?

Thanks,

Hello,

Today everything was back to normal running… without doing anything.

Then updated to 2.17.

Weird. :unamused:

Exactly the same problem here with 2.16.2, on OVH mutu
And no way to change manually the database parameters

Updated to 2.17.0, same problem

I’m running version 3.13.6 and yet have the same problem. Appears this error when run cron with core:archive.

Some suggestion to get a better debug? Follow my error.

ERROR [2020-07-03 07:17:46] 12307  Got invalid response from API request: ?module=API&method=API.get&idSite=10&period=year&date=last2&format=php&trigger=archivephp. Response was 'a:2:{s:6:"result";s:5:"error";s:7:"message";s:28395:"SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
#0 /prd1/piwik/libs/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#1 /prd1/piwik/libs/Zend/Db/Adapter/Abstract.php(479): Zend_Db_Statement->execute(Array)
#2 /prd1/piwik/libs/Zend/Db/Adapter/Pdo/Abstract.php(238): Zend_Db_Adapter_Abstract->query('DELETE FROM piw...', Array)
#3 /prd1/piwik/core/Db/Adapter/Pdo/Mysql.php(309): Zend_Db_Adapter_Pdo_Abstract->query('DELETE FROM piw...', Array)
#4 /prd1/piwik/core/Db.php(276): Piwik\Db\Adapter\Pdo\Mysql->query('DELETE FROM piw...', Array)
#5 /prd1/piwik/core/Concurrency/LockBackend/MySqlLockBackend.php(127): Piwik\Db::query('DELETE FROM piw...', Array)
#6 /prd1/piwik/core/Concurrency/LockBackend/MySqlLockBackend.php(95): Piwik\Concurrency\LockBackend\MySqlLockBackend->queryDidMakeChange('DELETE FROM piw...', Array)
#7 /prd1/piwik/core/Concurrency/Lock.php(116): Piwik\Concurrency\LockBackend\MySqlLockBackend->deleteIfKeyHasValue('Archiving.10.1a...', '2eb1107a6ee0')
#8 /prd1/piwik/core/ArchiveProcessor/ArchivingStatus.php(57): Piwik\Concurrency\Lock->unlock()
#9 /prd1/piwik/core/ArchiveProcessor/Loader.php(113): Piwik\ArchiveProcessor\ArchivingStatus->archiveFinished()
#10 /prd1/piwik/core/ArchiveProcessor/Loader.php(84): Piwik\ArchiveProcessor\Loader->prepareArchiveImpl('VisitsSummary')
#11 /prd1/piwik/core/Context.php(75): Piwik\ArchiveProcessor\Loader->Piwik\ArchiveProcessor\{closure}()
#12 /prd1/piwik/core/ArchiveProcessor/Loader.php(85): Piwik\Context::changeIdSite(10, Object(Closure))
#13 /prd1/piwik/core/Archive.php(803): Piwik\ArchiveProcessor\Loader->prepareArchive('VisitsSummary')
#14 /prd1/piwik/core/Archive.php(607): Piwik\Archive->prepareArchive(Array, Object(Piwik\Site), Object(Piwik\Period\Year))
#15 /prd1/piwik/core/Archive.php(551): Piwik\Archive->cacheArchiveIdsAfterLaunching(Array, Array)
#16 /prd1/piwik/core/Archive.php(480): Piwik\Archive->getArchiveIds(Array)
#17 /prd1/piwik/core/Archive.php(295): Piwik\Archive->get(Array, 'numeric')
#18 /prd1/piwik/plugins/VisitsSummary/API.php(36): Piwik\Archive->getDataTableFromNumeric(Array)
#19 [internal function]: Piwik\Plugins\VisitsSummary\API->get('10', 'year', 'last2', false, Array)
#20 /prd1/piwik/core/API/Proxy.php(237): call_user_func_array(Array, Array)
#21 /prd1/piwik/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#22 /prd1/piwik/core/API/Proxy.php(328): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#23 /prd1/piwik/plugins/API/API.php(437): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'get', Array)
#24 [internal function]: Piwik\Plugins\API\API->get('10', 'year', 'last2', false, Array)
#25 /prd1/piwik/core/API/Proxy.php(237): call_user_func_array(Array, Array)
#26 /prd1/piwik/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#27 /prd1/piwik/core/API/Proxy.php(328): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#28 /prd1/piwik/core/API/Request.php(266): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'get', Array)
#29 /prd1/piwik/plugins/API/Controller.php(41): Piwik\API\Request->process()
#30 [internal function]: Piwik\Plugins\API\Controller->index()
#31 /prd1/piwik/core/FrontController.php(590): call_user_func_array(Array, Array)
#32 /prd1/piwik/core/FrontController.php(165): Piwik\FrontController->doDispatch('API', false, Array)
#33 /prd1/piwik/core/dispatch.php(34): Piwik\FrontController->dispatch()
#34 /prd1/piwik/index.php(27): require_once('/prd1/piwik/cor...')
#35 /prd1/piwik/core/CliMulti/RequestCommand.php(79): require_once('/prd1/piwik/ind...')
#36 /prd1/piwik/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik \CliMulti\RequestCommand->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#37 /prd1/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#38 /prd1/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\CliMulti\RequestCommand), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#39 [internal function]: Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#40 /prd1/piwik/core/Console.php(140): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#41 /prd1/piwik/core/Access.php(644): Piwik\Console->Piwik\{closure}()
#42 /prd1/piwik/core/Console.php(141): Piwik\Access::doAsSuperUser(Object(Closure))
#43 /prd1/piwik/core/Console.php(93): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#44 /prd1/piwik/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#45 /prd1/piwik/console(32): Symfony\Component\Console\Application->run()
#46 {main}, caused by: SQLSTATE[HY000]: General error: 2006 MySQL server has gone away
#0 /prd1/piwik/libs/Zend/Db/Statement/Pdo.php(228): PDOStatement->execute(Array)
#1 /prd1/piwik/libs/Zend/Db/Statement.php(300): Zend_Db_Statement_Pdo->_execute(Array)
#2 /prd1/piwik/libs/Zend/Db/Adapter ... Output))
#54 /prd1/piwik/console(32): Symfony\Component\Console\Application->run()
#55 {main}";}'