Hi all, I am running into issues with our auto archiver. I’ve looked through the other forum posts regarding similar issues, but was not able to come up with a solution.
Setup
We have set up two Matomo installations on the same machine, one respecting DNT and one ignoring it, to analyse the differences in results we obtain. We have set up a proxy to forward incoming requests to both Matomo instances, so all visits are tracked by both of them. We use Docker Compose to manage our instances, databases and proxy configuration. Our site receives on average of about 40,000 visitors per day. We run the archiver using systemd services and timers.
We are only using 4 official plugins (Funnels, LogViewer, QueuedTracking and SearchEngineKeywordsPerformance), and all other plugins we use are core plugins.
Issue
Whenever we try to run the archiver using the console CLI, we we get the following error message:
# ./console core:archive --url=matomo.{domainname}
INFO [2021-09-22 08:03:53] 84 ---------------------------
INFO [2021-09-22 08:03:53] 84 INIT
INFO [2021-09-22 08:03:53] 84 Running Matomo 4.4.1 as Super User
INFO [2021-09-22 08:03:53] 84 ---------------------------
...
ERROR [2021-09-22 08:10:20] 84 Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=4&period=year&date=2021-01-01&format=json&trigger=archivephp. The response was empty. This usually means a server error. A solution to this error is generally to increase the value of 'memory_limit' in your php.ini file. For more information and the error message please check in your PHP CLI error log file. As this core:archive command triggers PHP processes over the CLI, you can find where PHP CLI logs are stored by running this command: php -i | grep error_log
INFO [2021-09-22 08:10:20] 84 ''
ERROR [2021-09-22 08:10:20] 84 Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=4&period=year&date=2021-01-01&format=json&trigger=archivephp: ''
...
Inspecting the log, we can see the following PHP errors:
ERROR Piwik\FrontController[2021-09-22 08:12:04 UTC] [4325] Fatal error encountered: /var/www/html/core/Common.php(301): Allowed memory size of 2147483648 bytes exhausted (tried to allocate 20480 bytes)
ERROR Piwik\FrontController[2021-09-22 08:12:04 UTC] [4325] on /var/www/html/core/Common.php(301)
ERROR Piwik\FrontController[2021-09-22 08:12:04 UTC] [4325] #0 /var/www/html/core/ArchiveProcessor.php(225): Piwik\ArchiveProcessor->aggregateDataTableRecord(name="Actions_actions_url")
ERROR Piwik\FrontController[2021-09-22 08:12:04 UTC] [4325] #1 /var/www/html/core/ArchiveProcessor/PluginsArchiver.php(168): Piwik\Plugins\Actions\Archiver->callAggregateMultipleReports()
ERROR Piwik\FrontController[2021-09-22 08:12:04 UTC] [4325] [Query: ?module=API&method=CoreAdminHome.archiveReports&idSite=4&period=year&date=2021-01-01&format=json&segment=visitorType%3D%3Dnew&trigger=archivephp&pid=09264d519699a890d6caa0bdfa2edf002f803672da2bfadbde111cd54759164ccb5a4d46d37b7b9f118f5669a5da5a3171381&runid=84, CLI mode: 1]
ERROR Piwik\FrontController[2021-09-22 08:12:07 UTC] [4337] Fatal error encountered: /var/www/html/core/DataTable/Row.php(75): Allowed memory size of 2147483648 bytes exhausted (tried to allocate 20480 bytes)
ERROR Piwik\FrontController[2021-09-22 08:12:07 UTC] [4337] on /var/www/html/core/DataTable/Row.php(75)
ERROR Piwik\FrontController[2021-09-22 08:12:07 UTC] [4337] #0 /var/www/html/core/ArchiveProcessor.php(225): Piwik\ArchiveProcessor->aggregateDataTableRecord(name="Actions_actions_url")
ERROR Piwik\FrontController[2021-09-22 08:12:07 UTC] [4337] #1 /var/www/html/core/ArchiveProcessor/PluginsArchiver.php(168): Piwik\Plugins\Actions\Archiver->callAggregateMultipleReports()
ERROR Piwik\FrontController[2021-09-22 08:12:07 UTC] [4337] [Query: ?module=API&method=CoreAdminHome.archiveReports&idSite=4&period=year&date=2021-01-01&format=json&segment=visitorType%3D%3Dreturning&trigger=archivephp&pid=f30d2618ab0c261a7ac4b0111e1062c23459ba6ce346279623c05ca6fe27d538441963046f4526e5e6d7894b503691cccd782&runid=84, CLI mode: 1]
ERROR Piwik\FrontController[2021-09-22 08:12:08 UTC] [4337] Fatal error encountered: /var/www/html/core/DataTable/Row.php(75): Allowed memory size of 2147483648 bytes exhausted (tried to allocate 20480 bytes)
ERROR Piwik\FrontController[2021-09-22 08:12:08 UTC] [4337] on /var/www/html/core/DataTable/Row.php(75)
ERROR Piwik\FrontController[2021-09-22 08:12:08 UTC] [4337] #0 /var/www/html/core/ArchiveProcessor.php(225): Piwik\ArchiveProcessor->aggregateDataTableRecord(name="Actions_actions_url")
ERROR Piwik\FrontController[2021-09-22 08:12:08 UTC] [4337] #1 /var/www/html/core/ArchiveProcessor/PluginsArchiver.php(168): Piwik\Plugins\Actions\Archiver->callAggregateMultipleReports()
ERROR Piwik\FrontController[2021-09-22 08:12:08 UTC] [4337] [Query: ?module=API&method=CoreAdminHome.archiveReports&idSite=4&period=year&date=2021-01-01&format=json&segment=visitorType%3D%3Dreturning&trigger=archivephp&pid=f30d2618ab0c261a7ac4b0111e1062c23459ba6ce346279623c05ca6fe27d538441963046f4526e5e6d7894b503691cccd782&runid=84, CLI mode: 1]
It appears to be an out of memory error (Allowed memory size of 2147483648 bytes exhausted
), but all info I can find online indicates 2GB should be more than enough to run the archiving job. In fact, we’ve even tried to bump it up to 4GB, but the archiving job still ran out of memory.
Does anyone know what the issue could be, or where I could look for problems in our installation? Or is it not unusual for sites with our visitor amounts to need more than 4GB of memory for the archiving task?
Thanks in advance!