Hello there,
I’m facing an issue that I can’t pin down to the root cause. During archiving I get the following error message
ERROR [2024-08-07 12:02:10] 1315761 Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=13&period=year&date=2024-01-01&format=json&trigger=archivephp.
Response was '{"result":"error","message":"The unserialization has failed! - in plugin Actions.
#0 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/Loader.php(289): Piwik\\ArchiveProcessor\\PluginsArchiver->callAggregateAllPlugins()
#1 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/Loader.php(181): Piwik\\ArchiveProcessor\\Loader->prepareAllPluginsArchive()
#2 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/Loader.php(164): Piwik\\ArchiveProcessor\\Loader->insertArchiveData()
#3 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/Loader.php(104): Piwik\\ArchiveProcessor\\Loader->prepareArchiveImpl()
#4 \/var\/www\/<url>_4.16.1\/piwik\/core\/Context.php(75): Piwik\\ArchiveProcessor\\Loader->Piwik\\ArchiveProcessor\\{closure}()
#5 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/Loader.php(101): Piwik\\Context::changeIdSite()
#6 \/var\/www\/<url>_4.16.1\/piwik\/plugins\/CoreAdminHome\/API.php(294): Piwik\\ArchiveProcessor\\Loader->prepareArchive()
#7 [internal function]: Piwik\\Plugins\\CoreAdminHome\\API->archiveReports()
#8 \/var\/www\/<url>_4.16.1\/piwik\/core\/API\/Proxy.php(244): call_user_func_array()
#9 \/var\/www\/<url>_4.16.1\/piwik\/core\/Context.php(28): Piwik\\API\\Proxy->Piwik\\API\\{closure}()
#10 \/var\/www\/<url>_4.16.1\/piwik\/core\/API\/Proxy.php(154): Piwik\\Context::executeWithQueryParameters()
#11 \/var\/www\/<url>_4.16.1\/piwik\/core\/API\/Request.php(267): Piwik\\API\\Proxy->call()
#12 \/var\/www\/<url>_4.16.1\/piwik\/plugins\/API\/Controller.php(45): Piwik\\API\\Request->process()
#13 [internal function]: Piwik\\Plugins\\API\\Controller->index()
#14 \/var\/www\/<url>_4.16.1\/piwik\/core\/FrontController.php(637): call_user_func_array()
#15 \/var\/www\/<url>_4.16.1\/piwik\/core\/FrontController.php(169): Piwik\\FrontController->doDispatch()
#16 \/var\/www\/<url>_4.16.1\/piwik\/core\/dispatch.php(32): Piwik\\FrontController->dispatch()
#17 \/var\/www\/<url>_4.16.1\/piwik\/index.php(25): require_once('...')
#18 \/var\/www\/<url>_4.16.1\/piwik\/core\/CliMulti\/RequestCommand.php(79): require_once('...')
#19 \/var\/www\/<url>_4.16.1\/piwik\/vendor\/symfony\/console\/Symfony\/Component\/Console\/Command\/Command.php(257): Piwik\\CliMulti\\RequestCommand->execute()
#20 \/var\/www\/<url>_4.16.1\/piwik\/vendor\/symfony\/console\/Symfony\/Component\/Console\/Application.php(874): Symfony\\Component\\Console\\Command\\Command->run()
#21 \/var\/www\/<url>_4.16.1\/piwik\/vendor\/symfony\/console\/Symfony\/Component\/Console\/Application.php(195): Symfony\\Component\\Console\\Application->doRunCommand()
#22 \/var\/www\/<url>_4.16.1\/piwik\/core\/Console.php(108): Symfony\\Component\\Console\\Application->doRun()
#23 [internal function]: Piwik\\Console->originDoRun()
#24 \/var\/www\/<url>_4.16.1\/piwik\/core\/Console.php(147): call_user_func()
#25 \/var\/www\/<url>_4.16.1\/piwik\/core\/Access.php(670): Piwik\\Console->Piwik\\{closure}()
#26 \/var\/www\/<url>_4.16.1\/piwik\/core\/Console.php(145): Piwik\\Access::doAsSuperUser()
#27 \/var\/www\/<url>_4.16.1\/piwik\/core\/Console.php(87): Piwik\\Console->doRunImpl()
#28 \/var\/www\/<url>_4.16.1\/piwik\/vendor\/symfony\/console\/Symfony\/Component\/Console\/Application.php(126): Piwik\\Console->doRun()
#29 \/var\/www\/<url>_4.16.1\/piwik\/console(32): Symfony\\Component\\Console\\Application->run()
#30 {main}, caused by: The unserialization has failed!
#0 \/var\/www\/<url>_4.16.1\/piwik\/core\/DataTable.php(1461): Piwik\\DataTable->unserializeRows()
#1 \/var\/www\/<url>_4.16.1\/piwik\/core\/DataTable.php(1936): Piwik\\DataTable->addRowsFromSerializedArray()
#2 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor.php(400): Piwik\\DataTable::fromSerializedArray()
#3 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor.php(375): Piwik\\ArchiveProcessor->getAggregatedDataTableMapFromBlobs()
#4 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor.php(232): Piwik\\ArchiveProcessor->aggregateDataTableRecord()
#5 \/var\/www\/<url>_4.16.1\/piwik\/plugins\/Actions\/Archiver.php(642): Piwik\\ArchiveProcessor->aggregateDataTableRecords()
#6 \/var\/www\/<url>_4.16.1\/piwik\/core\/Plugin\/Archiver.php(108): Piwik\\Plugins\\Actions\\Archiver->aggregateMultipleReports()
#7 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/PluginsArchiver.php(173): Piwik\\Plugin\\Archiver->callAggregateMultipleReports()
#8 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/Loader.php(289): Piwik\\ArchiveProcessor\\PluginsArchiver->callAggregateAllPlugins()
#9 \/var\/www\/<url>_4.16.1\/piwik\/core\/ArchiveProcessor\/Loader.php(181): Piwik\\ArchiveProcessor\\Loader->prepareAllPluginsArchive()
#10 \/var\/www\/<url>_4.16.1\/piwik\/console(32): Symfony\\Component\\Console\\Application->run()\n
#38 {main}"}'
INFO [2024-08-07 12:02:10] 1315761 Skipped Archiving website id 13, period = year, date = 2024-01-01, segment = '', 0 visits found. Time elapsed: 6.819s
I found the following command to reproduce the error
sudo -u www-data /usr/bin/php8.2 -q /var/www/<url>_4.16.1/piwik/console climulti:request -q --matomo-domain='<url>' --superuser 'module=API&method=CoreAdminHome.archiveReports&idSite=13&period=year&date=2024-01-01&format=json&trigger=archivephp'
I traced the execution with xdebug and found
423.4460 502076712 -> Piwik\DataAccess\ArchiveSelector::uncompress($data ='x<9C><EC><FD>i<8F><E2>X<B6>\006\n<FF><97><96><EE><F9><F2><CA>՞<87>.<B5><8E>\030\rx\000\f<B6><C1>_<90>\r<C6><F3><80>m0<E6><AA><FF><FB><85> <D8>63TFd<D7>{2K<AA><AC><A8><C8>`;<BC>ֳ<E6>a<EB><FF>b<98>^?<FD><BF>ο<B0>?<D3>^?a0I<FE><EB>\037<FA><BF>><BE>\001<FF><A9><FF>\v;}<81><90><FF><FA>^?<D3>^?\021<FF><FA><87><AF>\033<A6><FF><8F><FD>Ϣ<F8><BF><FE><F1>υcB~d<A6><EB>Ђ<9C>4<83><BC>(IL/<FB>ǟο<D0>ÿ<C4><FE>\017<E4><F0>\025v<F8>\003<C1>\016ߣ0<EA><F0>\r<F8><CF><C5><FE><E4><FD>\027ȟ<CE><F1>\v<F4>O<F1><F0>\037<EC>O<E3><E3><FF>\021\004<9C><C0><9C><8E>A\017^?A^?\034<83>\034<CF><FA><F8>.<FA><F9><<84>8}A<9F>><81><90>\037<DF><FA><CF><FE><AB><C3>k\034<DE>\002<FB><D7>?<D6><C9><C7>;<D0>Կ<FE>agY<9C><FE><EB><9F><FF><CC><F3><FC>\017OO\022<C7>ܿ<81><9E><9A>Ih<FE><B1>0<FF>y<FA>\026<E4><84><CB>(<FD><A7><BB><B6><CC>p\021GI<A6><FB><FF>\\<AD><9D><DD>}\022<FC><E7>@S<F1><F4>䒒<F0>%%<C9>\a<94><FC>_<DD>շ<B3>e<94>\004<FF>F<FE>g<96>\'z\034<9B><C9><C7><FF><EB>ٿ\027<C9>:<D6><FD><D9><E1>GN\024\'<E1>Ӌ<93>̉<E2>\bL<BC>N<F0><E3>\001<87>_\024=<A2>B<FF>\027u<F8><E2><F0>w<F8><C7>C<8E><A7>\034N<C7>1<FA><F8><C3><FB>o<FD>\001<E3>8q:\004<FC>\022<F8><91>)<87><8F><FC><E7><F0><D9><CA>a<C8><C5>a\bBU\016<83><E9><EB>Ð<CA>a<FF><B9><CD>P\004<FD>><8E><BE>Ί<92><F3><E8>\031<E7><A9>K<CE><D3>{<C6>/\023<DD>2!<E4><C4>@\n?<BD><EE><91>\002G\006R<E4><EB>\034<A4><F0><93>$<E0>\'<FC><E3>\'<9E>~<FC>.gl<C0>.y\n<C3>\0256`$\006W<FF>!<AF><98><82><9D>q\0309<E3>0zq6<C6><C0>4Re2<81>^3\031=;<F0>\f^?<D4><C5>y'...) /var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php:497
423.4460 502076712 > gzuncompress($data ='x<9C><EC><FD>i<8F><E2>X<B6>\006\n<FF><97><96><EE><F9><F2><CA>՞<87>.<B5><8E>\030\rx\000\f<B6><C1>_<90>\r<C6><F3><80>m0<E6><AA><FF><FB><85> <D8>63TFd<D7>{2K<AA><AC><A8><C8>`;<BC>ֳ<E6>a<EB><FF>b<98>^?<FD><BF>ο<B0>?<D3>^?a0I<FE><EB>\037<FA><BF>><BE>\001<FF><A9><FF>\v;}<81><90><FF><FA>^?<D3>^?\021<FF><FA><87><AF>\033<A6><FF><8F><FD>Ϣ<F8><BF><FE><F1>υcB~d<A6><EB>Ђ<9C>4<83><BC>(IL/<FB>ǟο<D0>ÿ<C4><FE>\017<E4><F0>\025v<F8>\003<C1>\016ߣ0<EA><F0>\r<F8><CF><C5><FE><E4><FD>\027ȟ<CE><F1>\v<F4>O<F1><F0>\037<EC>O<E3><E3><FF>\021\004<9C><C0><9C><8E>A\017^?A^?\034<83>\034<CF><FA><F8>.<FA><F9><<84>8}A<9F>><81><90>\037<DF><FA><CF><FE><AB><C3>k\034<DE>\002<FB><D7>?<D6><C9><C7>;<D0>Կ<FE>agY<9C><FE><EB><9F><FF><CC><F3><FC>\017OO\022<C7>ܿ<81><9E><9A>Ih<FE><B1>0<FF>y<FA>\026<E4><84><CB>(<FD><A7><BB><B6><CC>p\021GI<A6><FB><FF>\\<AD><9D><DD>}\022<FC><E7>@S<F1><F4>䒒<F0>%%<C9>\a<94><FC>_<DD>շ<B3>e<94>\004<FF>F<FE>g<96>\'z\034<9B><C9><C7><FF><EB>ٿ\027<C9>:<D6><FD><D9><E1>GN\024\'<E1>Ӌ<93>̉<E2>\bL<BC>N<F0><E3>\001<87>_\024=<A2>B<FF>\027u<F8><E2><F0>w<F8><C7>C<8E><A7>\034N<C7>1<FA><F8><C3><FB>o<FD>\001<E3>8q:\004<FC>\022<F8><91>)<87><8F><FC><E7><F0><D9><CA>a<C8><C5>a\bBU\016<83><E9><EB>Ð<CA>a<FF><B9><CD>P\004<FD>><8E><BE>Ί<92><F3><E8>\031<E7><A9>K<CE><D3>{<C6>/\023<DD>2!<E4><C4>@\n?<BD><EE><91>\002G\006R<E4><EB>\034<A4><F0><93>$<E0>\'<FC><E3>\'<9E>~<FC>.gl<C0>.y\n<C3>\0256`$\006W<FF>!<AF><98><82><9D>q\0309<E3>0zq6<C6><C0>4Re2<81>^3\031=;<F0>\f^?<D4><C5>y'...) /var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php:340
423.6420 502076800 -> Piwik\ErrorHandler::errorHandler($errno = 2, $errstr = 'gzuncompress(): data error', $errfile = '/var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php', $errline = 340) /var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php:340
423.6421 502076800 -> Piwik\ErrorHandler::createLogMessage($errno = 2, $errstr = 'gzuncompress(): data error', $errfile = '/var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php', $errline = 340) /var/www/<url>_4.16.1/piwik/core/ErrorHandler.php:137
423.6421 502076800 -> class_exists($class = 'Piwik\\Version') /var/www/<url>_4.16.1/piwik/core/ErrorHandler.php:195
423.6421 502077024 -> Piwik\ErrorHandler::getErrNoString($errno = 2) /var/www/<url>_4.16.1/piwik/core/ErrorHandler.php:198
423.6421 502077024 -> sprintf($format = '%s(%d): %s - %s - Matomo 4.16.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)', ...$values = variadic(0 => '/var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php', 1 => 340, 2 => 'Warning', 3 => 'gzuncompress(): data error')) /var/www/<url>_4.16.1/piwik/core/ErrorHandler.php:194
423.6421 502076800 -> error_reporting() /var/www/<url>_4.16.1/piwik/core/ErrorHandler.php:140
423.6421 502076712 -> Piwik\Archive\Chunk->isRecordNameAChunk($recordName = 'Actions_actions_url_chunk_0_99') /var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php:498
423.6422 502076712 -> Piwik\Archive\Chunk->getEndPosOfChunkAppendix($recordName = 'Actions_actions_url_chunk_0_99') /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:77
423.6422 502076712 -> Piwik\Archive\Chunk->getAppendix() /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:134
423.6422 502076712 -> strpos($haystack = 'Actions_actions_url_chunk_0_99', $needle = '_chunk_') /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:134
423.6422 502076712 -> Piwik\Archive\Chunk->getAppendix() /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:140
423.6422 502076712 -> strlen($string = '_chunk_') /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:140
423.6422 502076712 -> substr($string = 'Actions_actions_url_chunk_0_99', $offset = 26) /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:84
423.6422 502076744 -> Piwik\Archive\Chunk->isChunkRange($blobId = '0_99') /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:86
423.6422 502076744 -> explode($separator = '_', $string = '0_99') /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:91
423.6422 502076992 -> count($value = [0 => '0', 1 => '99']) /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:93
423.6422 502076992 -> is_numeric($value = '0') /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:93
423.6422 502076992 -> is_numeric($value = '99') /var/www/<url>_4.16.1/piwik/core/Archive/Chunk.php:93
423.6422 502076712 -> Piwik\Common::safe_unserialize($string = FALSE, $allowedClasses = ???, $rethrow = ???) /var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php:500
423.6422 502077088 -> unserialize($data = FALSE, $options = ['allowed_classes' => FALSE]) /var/www/<url>_4.16.1/piwik/core/Common.php:300
423.6422 502057232 -> is_array($value = FALSE) /var/www/<url>_4.16.1/piwik/core/DataAccess/ArchiveSelector.php:501
423.6423 500000584 -> Piwik\ArchiveProcessor->getSubtableIdFromBlobName($recordName = 'Actions_actions_url_chunk_0_99') /var/www/<url>_4.16.1/piwik/core/ArchiveProcessor.php:398
423.6423 500000584 -> explode($separator = '_', $string = 'Actions_actions_url_chunk_0_99') /var/www/<url>_4.16.1/piwik/core/ArchiveProcessor.php:465
423.6423 500000992 -> end($array = [0 => 'Actions', 1 => 'actions', 2 => 'url', 3 => 'chunk', 4 => '0', 5 => '99']) /var/www/<url>_4.16.1/piwik/core/ArchiveProcessor.php:466
423.6423 500000992 -> is_numeric($value = '99') /var/www/<url>_4.16.1/piwik/core/ArchiveProcessor.php:468
423.6423 500000616 -> Piwik\DataTable::fromSerializedArray($data = FALSE) /var/www/<url>_4.16.1/piwik/core/ArchiveProcessor.php:400
423.6423 500000936 -> Piwik\DataTable->__construct() /var/www/<url>_4.16.1/piwik/core/DataTable.php:1935
423.6423 500000936 -> Piwik\DataTable\Manager::getInstance() /var/www/<url>_4.16.1/piwik/core/DataTable.php:350
423.6423 500000936 -> Piwik\DataTable\Manager->addTable($table = class Piwik\DataTable { protected $rows = []; protected $currentId = NULL; protected $depthLevel = 0; protected $indexNotUpToDate = TRUE; protected $rebuildIndexContinuously = FALSE; protected $tableSortedBy = FALSE; protected $queuedFilters = []; protected $disabledFilters = []; protected $rowsCountBeforeLimitFilter = 0; protected $enableRecursiveSort = FALSE; protected $enableRecursiveFilters = FALSE; protected $rowsIndexByLabel = []; protected $summaryRow = NULL; protected $totalsRow = NULL; protected $metadata = []; protected $maximumAllowedRows = 0 }) /var/www/<url>_4.16.1/piwik/core/DataTable.php:350
423.6423 500001632 -> Piwik\DataTable->addRowsFromSerializedArray($serialized = FALSE) /var/www/<url>_4.16.1/piwik/core/DataTable.php:1936
423.6423 500001632 -> Piwik\DataTable->unserializeRows($serialized = FALSE) /var/www/<url>_4.16.1/piwik/core/DataTable.php:1461
423.6423 500001632 -> str_replace($search = [0 => 'O:39:"Piwik\\DataTable\\Row\\DataTableSummaryRow"', 1 => 'O:19:"Piwik\\DataTable\\Row"', 2 => 'O:36:"Piwik_DataTable_Row_DataTableSummary"', 3 => 'O:19:"Piwik_DataTable_Row"'], $replace = 'O:29:"Piwik_DataTable_SerializedRow"', $subject = FALSE) /var/www/<url>_4.16.1/piwik/core/DataTable.php:1434
423.6423 500001632 -> Piwik\Common::safe_unserialize($string = '', $allowedClasses = [0 => 'Piwik\\DataTable\\Row', 1 => 'Piwik\\DataTable\\Row\\DataTableSummaryRow', 2 => 'Piwik_DataTable_SerializedRow'], $rethrow = ???) /var/www/<url>_4.16.1/piwik/core/DataTable.php:1435
423.6423 500002008 -> unserialize($data = '', $options = ['allowed_classes' => [0 => 'Piwik\\DataTable\\Row', 1 => 'Piwik\\DataTable\\Row\\DataTableSummaryRow', 2 => 'Piwik_DataTable_SerializedRow']]) /var/www/<url>_4.16.1/piwik/core/Common.php:300
423.6424 500017960 -> Exception->__construct($message = 'The unserialization has failed!') /var/www/<url>_4.16.1/piwik/core/DataTable.php:1442
Unfortunately this doesn’t help me narrowing down the root cause. I guess that there is some buggy tracking data in the database, or something like that. As it only affects this siteid and only the year period during archiving.
Does anybody have an idea how I can narrow this down?