Open diogobcp opened 6 months ago
Hi @diogobcp, thanks for the detailed report :+1: Could you check what the PHP memory limit is for PHP on the command line? Unserialization is a memory intensive part of the process so the error could be an indication that PHP running out of memory.
Hi @bx80,
We have it set at 10GB:
php -i | grep "memory_limit"
memory_limit => 10G => 10G
Hello diogobcp As a workaround, until the developers respond, I can share my own solution.
I too received this same error, for many weeks:
message: The unserialization has failed!
I too failed to solve it with greater memory size.
I solved it by making the archiving more incremental.
What worked for me, during trial and error. I tried these three things. Notice that the first failed:
php -d memory_limit=9G ./console core:archive --force-idsites=2 --force-date-last-n=1
FAILED: UNSERIALIZATION ERROR
php -d memory_limit=9G ./console core:archive --concurrent-requests-per-website=1 --concurrent-archivers=3 --skip-all-segments --force-idsites=2
SUCCESS. NOTICE I RAN NO SEGMENTS
php -d memory_limit=9G ./console core:archive --concurrent-requests-per-website=1 --concurrent-archivers=3 --force-idsites=2
SUCCESS. THIS WAS THE SAME THING I JUST RAN, BUT NOW WITH SEGMENTS ALLOWED
Your needs will be different. What I recommend for everyone:
Experiment at the command line by manually running combinations of
core:invalidate-report-data
and core:archive
. Try to achieve an incremental approach to the data processing.
Hi @atom-box
I tried every possible combination that I could think of, I even tried running the archive using 32GB RAM and that also failed.
Two examples:
php8 -d memory_limit=32G /srv/www/htdocs/matomo/console core:archive --concurrent-requests-per-website=1 --concurrent-archivers=3 --force-idsites=1
FAILED, with message:
81550 Error: Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=year&date=2024-01-01&format=json&segment=referrerName%3D%3DGoogle&trigger=archivephp. Response was '{"result":"error","message":"The unserialization has failed! - in plugin Actions.
php8 -d memory_limit=24G /srv/www/htdocs/matomo/console core:archive --concurrent-requests-per-website=1 --concurrent-archivers=3 --skip-all-segments --force-idsites=1
FAILED, with message:
Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=year&date=2024-01-01&format=json&trigger=archivephp. Response was '{"result":"error","message":"The unserialization has failed! - in plugin Actions.
It seems to always fail when the period is "year", is there any way we can pinpoint the issue? Is there a way to enable additional logging data on the archive job?
What happened?
Since January archiving jobs are failling with the following error:
Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=year&date=2024-01-01&format=json&trigger=archivephp. Response was '{"result":"error","message":"The unserialization has failed! - in plugin Actions. #0 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(313): Piwik\\ArchiveProcessor\\PluginsArchiver->callAggregateAllPlugins() #1 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(185): Piwik\\ArchiveProcessor\\Loader->prepareAllPluginsArchive() #2 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(164): Piwik\\ArchiveProcessor\\Loader->insertArchiveData() #3 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(104): Piwik\\ArchiveProcessor\\Loader->prepareArchiveImpl() #4 \/srv\/www\/htdocs\/matomo\/core\/Context.php(75): Piwik\\ArchiveProcessor\\Loader->Piwik\\ArchiveProcessor\\{closure}() #5 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(108): Piwik\\Context::changeIdSite() #6 \/srv\/www\/htdocs\/matomo\/plugins\/CoreAdminHome\/API.php(305): Piwik\\ArchiveProcessor\\Loader->prepareArchive() #7 [internal function]: Piwik\\Plugins\\CoreAdminHome\\API->archiveReports() #8 \/srv\/www\/htdocs\/matomo\/core\/API\/Proxy.php(255): call_user_func_array() #9 \/srv\/www\/htdocs\/matomo\/core\/Context.php(28): Piwik\\API\\Proxy->Piwik\\API\\{closure}() #10 \/srv\/www\/htdocs\/matomo\/core\/API\/Proxy.php(346): Piwik\\Context::executeWithQueryParameters() #11 \/srv\/www\/htdocs\/matomo\/core\/API\/Request.php(272): Piwik\\API\\Proxy->call() #12 \/srv\/www\/htdocs\/matomo\/plugins\/API\/Controller.php(45): Piwik\\API\\Request->process() #13 [internal function]: Piwik\\Plugins\\API\\Controller->index() #14 \/srv\/www\/htdocs\/matomo\/core\/FrontController.php(637): call_user_func_array() #15 \/srv\/www\/htdocs\/matomo\/core\/FrontController.php(169): Piwik\\FrontController->doDispatch() #16 \/srv\/www\/htdocs\/matomo\/core\/dispatch.php(32): Piwik\\FrontController->dispatch() #17 \/srv\/www\/htdocs\/matomo\/index.php(25): require_once('...') #18 \/srv\/www\/htdocs\/matomo\/core\/CliMulti\/RequestCommand.php(75): require_once('...') #19 \/srv\/www\/htdocs\/matomo\/core\/Plugin\/ConsoleCommand.php(110): Piwik\\CliMulti\\RequestCommand->doExecute() #20 \/srv\/www\/htdocs\/matomo\/vendor\/symfony\/console\/Command\/Command.php(298): Piwik\\Plugin\\ConsoleCommand->execute() #21 \/srv\/www\/htdocs\/matomo\/core\/Plugin\/ConsoleCommand.php(125): Symfony\\Component\\Console\\Command\\Command->run() #22 \/srv\/www\/htdocs\/matomo\/vendor\/symfony\/console\/Application.php(1040): Piwik\\Plugin\\ConsoleCommand->run() #23 \/srv\/www\/htdocs\/matomo\/vendor\/symfony\/console\/Application.php(301): Symfony\\Component\\Console\\Application->doRunCommand() #24 \/srv\/www\/htdocs\/matomo\/core\/Console.php(112): Symfony\\Component\\Console\\Application->doRun() #25 [internal function]: Piwik\\Console->originDoRun() #26 \/srv\/www\/htdocs\/matomo\/core\/Console.php(151): call_user_func() #27 \/srv\/www\/htdocs\/matomo\/core\/Access.php(670): Piwik\\Console->Piwik\\{closure}() #28 \/srv\/www\/htdocs\/matomo\/core\/Console.php(152): Piwik\\Access::doAsSuperUser() #29 \/srv\/www\/htdocs\/matomo\/core\/Console.php(91): Piwik\\Console->doRunImpl() #30 \/srv\/www\/htdocs\/matomo\/vendor\/symfony\/console\/Application.php(171): Piwik\\Console->doRun() #31 \/srv\/www\/htdocs\/matomo\/console(32): Symfony\\Component\\Console\\Application->run() #32 {main}, caused by: The unserialization has failed! #0 \/srv\/www\/htdocs\/matomo\/core\/DataTable.php(1481): Piwik\\DataTable->unserializeRows() #1 \/srv\/www\/htdocs\/matomo\/core\/DataTable.php(1974): Piwik\\DataTable->addRowsFromSerializedArray() #2 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor.php(402): Piwik\\DataTable::fromSerializedArray() #3 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor.php(377): Piwik\\ArchiveProcessor->getAggregatedDataTableMapFromBlobs() #4 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor.php(233): Piwik\\ArchiveProcessor->aggregateDataTableRecord() #5 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/RecordBuilder.php(202): Piwik\\ArchiveProcessor->aggregateDataTableRecords() #6 \/srv\/www\/htdocs\/matomo\/core\/Plugin\/Archiver.php(247): Piwik\\ArchiveProcessor\\RecordBuilder->buildForNonDayPeriod() #7 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/PluginsArchiver.php(189): Piwik\\Plugin\\Archiver->callAggregateMultipleReports() #8 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(313): Piwik\\ArchiveProcessor\\PluginsArchiver->callAggregateAllPlugins() #9 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(185): Piwik\\ArchiveProcessor\\Loader->prepareAllPluginsArchive() #10 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(164): Piwik\\ArchiveProcessor\\Loader->insertArchiveData() #11 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(104): Piwik\\ArchiveProcessor\\Loader->prepareArchiveImpl() #12 \/srv\/www\/htdocs\/matomo\/core\/Context.php(75): Piwik\\ArchiveProcessor\\Loader->Piwik\\ArchiveProcessor\\{closure}() #13 \/srv\/www\/htdocs\/matomo\/core\/ArchiveProcessor\/Loader.php(108): Piwik\\Context::changeIdSite() #14 \/srv\/www\/htdocs\/matomo\/plugins\/CoreAdminHome\/API.php(305): Piwik\\ArchiveProcessor\\Loader->prepareArchive() #15 [internal function]: Piwik\\Plugins\\CoreAdminHome\\API->archiveReports() #16 \/srv\/www\/htdocs\/matomo\/core\/API\/Proxy.php(255): call_user_func_array() #17 \/srv\/www\/htdocs\/matomo\/core\/Context.php(28): Piwik\\API\\Proxy->Piwik\\API\\{closure}() #18 \/srv\/www\/htdocs\/matomo\/core\/API\/Proxy.php(346): Piwik\\Context::executeWithQueryParameters() #19 \/srv\/www\/htdocs\/matomo\/core\/API\/Request.php(272): Piwik\\API ... rv\/www\/htdocs\/matomo\/console(32): Symfony\\Component\\Console\\Application->run()\n#40 {main}"}'
What should happen?
Whenever the archiving cron job runs we are getting this error, which is not allowing the successful completion of the archival cron.
How can this be reproduced?
Run the archive job from the command prompt.
Matomo version
5.0.3
PHP version
8.1.13
Server operating system
SUSE Linux Enterprise Server
What browsers are you seeing the problem on?
No response
Computer operating system
No response
Relevant log output
Validations