We migrated a matomo 5.4 server from Windows 2012 box to a W2022 box.
The process was to backup and restore the MariaDB database, and copy the matomo folder.
The diagnostics page was indicating that the archive process needed to be run and when we tried we received several errors like this:
“ERROR [2025-10-15 08:54:27] 8792 Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=3&period=day&date=2025-09-11&format=json&plugin=Actions&trigger=archivephp&pluginOnly=1&requestedReport=Actions_hits: ‘Got invalid response from API request: hostname/matomo/?module=API&method=CoreAdminHome.archiveReports&idSite=3&period=day&date=2025-09-11&format=json&plugin=Actions&trigger=archivephp&pluginOnly=1&requestedReport=Actions_hits&. The response was empty. This usually means a server error. This solution to this error is generally to increase the value of ‘memory_limit’ in your php.ini file. Please check your Web server Error Log file for more details.’
ERROR [2025-10-15 10:22:33] 9092 218 total errors during this script execution, please investigate and try and fix these errors.
ERROR [2025-10-15 10:22:33] 9092 Uncaught exception: \core\CronArchive.php(741): 218 total errors during this script execution, please investigate and try and fix these errors. [Query: , CLI mode: 1]
In CronArchive.php line 741:
218 total errors during this script execution, please investigate and try and fix these errors.
After that we tried to use fresh matomo install files and restore the database.
We tried also to update to matomo 5.5 to see if it was possible to fix the errors, but the issue is not solved.
The web server log only shows hits with web code 204.
Just to add that memory_limit is set to 4G in php.ini
Regards
Hi, you have prob. seen these post. Maybe they help. It may not be the root cause as Stefan is saying but may help not getting the error. If the data is corrupt somehow, this will not fix the root cause, but maybe it suppress the error. I think Matomo should be more resilience to this, even do the source of the error/corrupt data is somewhere else.
I do have the same error and getting emails warnings from the cron job, running Matomo 5.4 with MariaDB 10.5.28 (if I am not wrong). This started after upgrading to 5.4 from 5.2.2. Still investigating this. I also have a warning about “Allowed memory size of 805306368 bytes exhausted“ but that is not the case, I’ve increased the script memory limit for the cron job and also in the PHP.ini file, I tested with up to 8GB of memory for the script and php.ini but no difference.
opened 10:07AM - 04 Dec 24 UTC
Potential Bug
### What happened?
Please check: https://forum.matomo.org/t/serialization-error… -while-archiving/61411, especially:
The problem is solved when
a) in core/DataTable.php, function unserializeRows.php, add right before ‘return $rows’: if(!is_array($rows)) { $rows = array(); }
b) in core/DataAccess/ArchiveSelector.php, function querySingleBlob, change line 646 to: if(is_array($blobs)) { ksort($blobs); }
There seems to be empty data rows which at least has to be an empty array.
If this is true, how does it happen, what is the best was to clean the data?
### What should happen?
archivephp cron job should not break for specific tracked webpages
### How can this be reproduced?
e.g.: /usr/bin/php /var/www/piwik/console climulti:request --matomo-domain=“https://xxx/” --superuser “module=API&method=CoreAdminHome.archiveReports&idSite=58&period=year&date=2024-01-01&format=json&trigger=archivephp”
### Matomo version
5.1.2
### PHP version
8.3.14
### Server operating system
Ubuntu 22.04.5 LTS
### What browsers are you seeing the problem on?
_No response_
### Computer operating system
_No response_
### Relevant log output
```shell
INFO [2024-11-22 07:30:39] 1236 Error: Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=59&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/dbuser/core/ArchiveProcessor/Loader.php(317): Piwik\ArchiveProcessor\PluginsArchiver->callAggregateAllPlugins() #1 /var/www/dbuser/core/ArchiveProcessor/Loader.php(186): Piwik\ArchiveProcessor\Loader->prepareAllPluginsArchive() #2 /var/www/dbuser/core/ArchiveProcessor/Loader.php(165): Piwik\ArchiveProcessor\Loader->insertArchiveData() #3 /var/www/dbuser/core/ArchiveProcessor/Loader.php(105): Piwik\ArchiveProcessor\Loader->prepareArchiveImpl() #4 /var/www/dbuser/core/Context.php(76): Piwik\ArchiveProcessor\Loader->Piwik\ArchiveProcessor\{closure}() #5 /var/www/dbuser/core/ArchiveProcessor/Loader.php(102): Piwik\Context::changeIdSite() #6 /var/www/dbuser/plugins/CoreAdminHome/API.php(306): Piwik\ArchiveProcessor\Loader->prepareArchive() #7 [internal function]: Piwik\Plugins\CoreAdminHome\API->archiveReports() #8 /var/www/dbuser/core/API/Proxy.php(255): call_user_func_array() #9 /var/www/dbuser/core/Context.php(29): Piwik\API\Proxy->Piwik\API\{closure}() #10 /var/www/dbuser/core/API/Proxy.php(158): Piwik\Context::executeWithQueryParameters() #11 /var/www/dbuser/core/API/Request.php(274): Piwik\API\Proxy->call() #12 /var/www/dbuser/plugins/API/Controller.php(46): Piwik\API\Request->process() #13 [internal function]: Piwik\Plugins\API\Controller->index() #14 /var/www/dbuser/core/FrontController.php(645): call_user_func_array() #15 /var/www/dbuser/core/FrontController.php(169): Piwik\FrontController->doDispatch() #16 /var/www/dbuser/core/dispatch.php(33): Piwik\FrontController->dispatch() #17 /var/www/dbuser/index.php(25): require_once(’…‘) #18 /var/www/dbuser/core/CliMulti/RequestCommand.php(76): require_once(’…‘) #19 /var/www/dbuser/core/Plugin/ConsoleCommand.php(109): Piwik\CliMulti\RequestCommand->doExecute() #20 /var/www/dbuser/vendor/symfony/console/Command/Command.php(298): Piwik\Plugin\ConsoleCommand->execute() #21 /var/www/dbuser/core/Plugin/ConsoleCommand.php(124): Symfony\Component\Console\Command\Command->run() #22 /var/www/dbuser/vendor/symfony/console/Application.php(1040): Piwik\Plugin\ConsoleCommand->run() #23 /var/www/dbuser/vendor/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand() #24 /var/www/dbuser/core/Console.php(113): Symfony\Component\Console\Application->doRun() #25 [internal function]: Piwik\Console->originDoRun() #26 /var/www/dbuser/core/Console.php(152): call_user_func() #27 /var/www/dbuser/core/Access.php(672): Piwik\Console->Piwik\{closure}() #28 /var/www/dbuser/core/Console.php(150): Piwik\Access::doAsSuperUser() #29 /var/www/dbuser/core/Console.php(92): Piwik\Console->doRunImpl() #30 /var/www/dbuser/vendor/symfony/console/Application.php(171): Piwik\Console->doRun() #31 /var/www/dbuser/console(32): Symfony\Component\Console\Application->run() #32 {main}, caused by: The unserialization has failed! #0 /var/www/dbuser/core/DataTable.php(1494): Piwik\DataTable->unserializeRows() #1 /var/www/dbuser/core/DataTable.php(1987): Piwik\DataTable->addRowsFromSerializedArray() #2 /var/www/dbuser/core/ArchiveProcessor.php(403): Piwik\DataTable::fromSerializedArray() #3 /var/www/dbuser/core/ArchiveProcessor.php(378): Piwik\ArchiveProcessor->getAggregatedDataTableMapFromBlobs() #4 /var/www/dbuser/core/ArchiveProcessor.php(234): Piwik\ArchiveProcessor->aggregateDataTableRecord() #5 /var/www/dbuser/core/ArchiveProcessor/RecordBuilder.php(205): Piwik\ArchiveProcessor->aggregateDataTableRecords() #6 /var/www/dbuser/core/Plugin/Archiver.php(247): Piwik\ArchiveProcessor\RecordBuilder->buildForNonDayPeriod() #7 /var/www/dbuser/core/ArchiveProcessor/PluginsArchiver.php(190): Piwik\Plugin\Archiver->callAggregateMultipleReports() #8 /var/www/dbuser/core/ArchiveProcessor/Loader.php(317): Piwik\ArchiveProcessor\PluginsArchiver->callAggregateAllPlugins() #9 /var/www/dbuser/core/ArchiveProcessor/Loader.php(186): Piwik\ArchiveProcessor\Loader->prepareAllPluginsArchive() #10 /var/www/dbuser/core/ArchiveProcessor/Loader.php(165): Piwik\ArchiveProcessor\Loader->insertArchiveData() #11 /var/www/dbuser/core/ArchiveProcessor/Loader.php(105): Piwik\ArchiveProcessor\Loader->prepareArchiveImpl() #12 /var/www/dbuser/core/Context.php(76): Piwik\ArchiveProcessor\Loader->Piwik\ArchiveProcessor\{closure}() #13 /var/www/dbuser/core/ArchiveProcessor/Loader.php(102): Piwik\Context::changeIdSite() #14 /var/www/dbuser/plugins/CoreAdminHome/API.php(306): Piwik\ArchiveProcessor\Loader->prepareArchive() #15 [internal function]: Piwik\Plugins\CoreAdminHome\API->archiveReports() #16 /var/www/dbuser/core/API/Proxy.php(255): call_user_func_array() #17 /var/www/dbuser/core/Context.php(29): Piwik\API\Proxy->Piwik\API\{closure}() #18 /var/www/dbuser/core/API/Proxy.php(158): Piwik\Context::executeWithQueryParameters() #19 /var/www/dbuser/core/API/Request.php(274): Piwik\API\Proxy->call() #20 /var/www/dbuser/plugins/API/Controller.php(46): Piwik\API\Request->process() #21 [internal function]: Piwik\Plugins\API\Controller->index() #22 /var/www/dbuser/core/FrontController.php(645): call_user_func_array() #23 /var/www/dbuser/core/FrontController.php(169): Piwik\FrontController->doDispatch() #24 /var/www/dbuser/core … n#39 /var/www/dbuser/console(32): Symfony\Component\Console\Application->run()\n#40 {main}"}’
```
### Validations
- [X] Read our [Contributing Guidelines](https://github.com/matomo-org/matomo/blob/5.x-dev/CONTRIBUTING.md).
- [X] Follow our [Security Policy](https://github.com/matomo-org/matomo/blob/5.x-dev/SECURITY.md).
- [X] Check that there isn't already an issue that reports the same bug to avoid creating duplicates.
- [X] The provided steps to reproduce is a [minimal reproducible](https://stackoverflow.com/help/minimal-reproducible-example) of the Bug.
Hi Philippe,
thank you for your help!
kind of archive: yearly
daily tracking volume:
Visits Overview 02 - 04 Dezember 2024
10,922 visits, 7,239 unique visitors -64.9%
5 min 12s average visit duration -8%
23% visits have bounced (left the website after one page) -4.2%
5.8 actions (page views, downloads, outlinks and internal site searches) per visit -1.7%
230 max actions in one visit -36.8%
54,361 pageviews, 41,723 unique pageviews -65.8%
150 total searches on your website, 7…