Skip to content

[Bug] Matomo archiving consistently fails with deadlocks #23999

@dwagelaar

Description

@dwagelaar

What happened?

Many runs of php core:archive fail with vsprintf('Encountered dea...', Array). This runs as a Kubernetes cron job, so it fails regularly.

What should happen?

Archiving should finish without errors.

How can this be reproduced?

Run /usr/local/bin/php /var/www/html/console core:archive --concurrent-archivers=6 --max-archives-to-process=500 --url=<redacted> || echo "Archiving failed"

Matomo version

5.2.1

PHP version

8.3.16

Server operating system

Debian GNU/Linux 12 (matomo:5.2.1 dockerhub image)

What browsers are you seeing the problem on?

Not applicable (e.g. an API call etc.)

Computer operating system

No response

Relevant log output

INFO      [2026-01-23 06:05:01] 12  ---------------------------
INFO      [2026-01-23 06:05:01] 12  INIT
INFO      [2026-01-23 06:05:01] 12  Running Matomo 5.2.1 as Super User
INFO      [2026-01-23 06:05:01] 12  ---------------------------
INFO      [2026-01-23 06:05:01] 12  NOTES
INFO      [2026-01-23 06:05:01] 12  - Async process archiving supported, using CliMulti.
INFO      [2026-01-23 06:05:01] 12  - Reports for today will be processed at most every 900 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO      [2026-01-23 06:05:01] 12  - Maximum 500 archives will be processed (soft limit).
INFO      [2026-01-23 06:05:01] 12  - Archiving was last executed without error 5 hours 17 min ago.
INFO      [2026-01-23 06:05:01] 12  - Continuing ongoing archiving run by pulling from shared idSite queue.
INFO      [2026-01-23 06:05:01] 12  ---------------------------
INFO      [2026-01-23 06:05:01] 12  START
INFO      [2026-01-23 06:05:01] 12  Starting Matomo reports archiving...
INFO      [2026-01-23 06:05:01] 12  1 out of 6 archivers running currently
INFO      [2026-01-23 06:05:01] 12  Start processing archives for site 9.
INFO      [2026-01-23 06:05:01] 12    Will invalidate archived reports for today in site ID = 9's timezone (2026-01-23 00:00:00).
INFO      [2026-01-23 06:05:01] 12    Will invalidate archived reports for yesterday in site ID = 9's timezone (2026-01-22 00:00:00).
INFO      [2026-01-23 06:05:05] 12  Archived website id 9, period = day, date = 2026-01-23, segment = '', 20 visits found. Time elapsed: 3.175s
INFO      [2026-01-23 06:05:05] 12  Archived website id 9, period = range, date = 2026-01-16,2026-01-22, segment = '', 26253 visits found. Time elapsed: 3.684s
INFO      [2026-01-23 06:05:09] 12  Archived website id 9, period = week, date = 2026-01-19, segment = '', 19929 visits found. Time elapsed: 3.885s
INFO      [2026-01-23 06:05:10] 12  Archived website id 9, period = range, date = 2026-01-17,2026-01-23, segment = '', 21663 visits found. Time elapsed: 0.598s
INFO      [2026-01-23 06:05:21] 12  Archived website id 9, period = month, date = 2026-01-01, segment = '', 75043 visits found. Time elapsed: 11.695s
INFO      [2026-01-23 06:05:22] 12  Archived website id 9, period = year, date = 2026-01-01, segment = '', 75043 visits found. Time elapsed: 0.489s
INFO      [2026-01-23 06:05:22] 12  Finished archiving for site 9, 6 API requests, Time elapsed: 20.520s [1 / 23 done]
INFO      [2026-01-23 06:05:22] 12  Start processing archives for site 10.
INFO      [2026-01-23 06:05:22] 12  Finished archiving for site 10, 0 API requests, Time elapsed: 0.029s [2 / 23 done]
INFO      [2026-01-23 06:05:22] 12  Start processing archives for site 11.
INFO      [2026-01-23 06:05:22] 12    Will invalidate archived reports for today in site ID = 11's timezone (2026-01-23 00:00:00).
INFO      [2026-01-23 06:05:22] 12    Will invalidate archived reports for yesterday in site ID = 11's timezone (2026-01-22 00:00:00).
INFO      [2026-01-23 06:05:23] 12  Archived website id 11, period = day, date = 2026-01-23, segment = '', 7 visits found. Time elapsed: 0.553s
...
ERROR     [2026-01-23 06:07:56] 12  Got invalid response from API request: ?module=API&method=CoreAdminHome.archiveReports&idSite=14&period=week&date=2026-01-19&format=json&segment=pageUrl%3D%40%25252Fessential%25252F&trigger=archivephp. Response was '{"result":"error","message":"Unknown format specifier &quot;A&quot; on \/var\/www\/html\/plugins\/Monolog\/Processor\/SprintfProcessor.php(25) #0 \/var\/www\/html\/plugins\/Monolog\/Processor\/SprintfProcessor.php(25): vsprintf('Encountered dea...', Array) #1 [internal function]: Piwik\\Plugins\\Monolog\\Processor\\SprintfProcessor-&gt;__invoke(Array) #2 \/var\/www\/html\/vendor\/monolog\/monolog\/src\/Monolog\/Logger.php(340): call_user_func(Object(Piwik\\Plugins\\Monolog\\Processor\\SprintfProcessor), Array) #3 \/var\/www\/html\/vendor\/monolog\/monolog\/src\/Monolog\/Logger.php(614): Monolog\\Logger-&gt;addRecord(100, 'Encountered dea...', Array) #4 \/var\/www\/html\/core\/Log.php(210): Monolog\\Logger-&gt;log(100, 'Encountered dea...', Array) #5 \/var\/www\/html\/core\/Log.php(215): Piwik\\Log-&gt;doLog(100, 'Encountered dea...', Array) #6 \/var\/www\/html\/core\/Log.php(177): Piwik\\Log::logMessage(100, Object(Exception), Array) #7 \/var\/www\/html\/core\/Db.php(819): Piwik\\Log::debug(Object(Exception)) #8 \/var\/www\/html\/core\/Db.php(288): Piwik\\Db::logExtraInfoIfDeadlock(Object(Zend_Db_Statement_Exception)) #9 \/var\/www\/html\/core\/DataAccess\/Model.php(192): Piwik\\Db::query('UPDATE `matomo_...') #10 \/var\/www\/html\/core\/Archive\/ArchiveInvalidator.php(731): Piwik\\DataAccess\\Model-&gt;updateArchiveAsInvalidated('matomo_archive_...', Array, Array, Object(Piwik\\Segment), false, NULL, true) #11 \/var\/www\/html\/core\/Archive\/ArchiveInvalidator.php(334): Piwik\\Archive\\ArchiveInvalidator-&gt;markArchivesInvalidated(Array, Array, Object(Piwik\\Segment), true, false, 'VisitsSummary', true) #12 \/var\/www\/html\/core\/ArchiveProcessor.php(809): Piwik\\Archive\\ArchiveInvalidator-&gt;markArchivesAsInvalidated(Array, Array, 'week', Object(Piwik\\Segment), false, false, 'VisitsSummary', false, true) #13 \/var\/www\/html\/core\/Plugin\/Archiver.php(411): Piwik\\ArchiveProcessor-&gt;processDependentArchive('VisitsSummary', 'visitorType%3D%...') #14 \/var\/www\/html\/core\/Plugin\/Archiver.php(274): Piwik\\Plugin\\Archiver-&gt;processDependentArchivesForPlugins() #15 \/var\/www\/html\/core\/ArchiveProcessor\/PluginsArchiver.php(190): Piwik\\Plugin\\Archiver-&gt;callAggregateMultipleReports() #16 \/var\/www\/html\/core\/ArchiveProcessor\/Loader.php(317): Piwik\\ArchiveProcessor\\PluginsArchiver-&gt;callAggregateAllPlugins(240.0, 0, false) #17 \/var\/www\/html\/core\/ArchiveProcessor\/Loader.php(186): Piwik\\ArchiveProcessor\\Loader-&gt;prepareAllPluginsArchive(240.0, 0) #18 \/var\/www\/html\/core\/ArchiveProcessor\/Loader.php(165): Piwik\\ArchiveProcessor\\Loader-&gt;insertArchiveData(239.0, 0, false, NULL) #19 \/var\/www\/html\/core\/ArchiveProcessor\/Loader.php(105): Piwik\\ArchiveProcessor\\Loader-&gt;prepareArchiveImpl(false) #20 \/var\/www\/html\/core\/Context.php(76): Piwik\\ArchiveProcessor\\Loader-&gt;Piwik\\ArchiveProcessor\\{closure}() #21 \/var\/www\/html\/core\/ArchiveProcessor\/Loader.php(102): Piwik\\Context::changeIdSite(14, Object(Closure)) #22 \/var\/www\/html\/plugins\/CoreAdminHome\/API.php(306): Piwik\\ArchiveProcessor\\Loader-&gt;prepareArchive(false) #23 [internal function]: Piwik\\Plugins\\CoreAdminHome\\API-&gt;archiveReports('14', Object(Piwik\\Period\\Week), '2026-01-19', 'pageUrl%3D%40%2...', false, false) #24 \/var\/www\/html\/core\/API\/Proxy.php(256): call_user_func_array(Array, Array) #25 \/var\/www\/html\/core\/Context.php(29): Piwik\\API\\Proxy-&gt;Piwik\\API\\{closure}() #26 \/var\/www\/html\/core\/API\/Proxy.php(159): Piwik\\Context::executeWithQueryParameters(Array, Object(Closure)) #27 \/var\/www\/html\/core\/API\/Request.php(274): Piwik\\API\\Proxy-&gt;call('\\\\Piwik\\\\Plugins\\\\...', 'archiveReports', Array) #28 \/var\/www\/html\/plugins\/API\/Controller.php(46): Piwik\\API\\Request-&gt;process() #29 [internal function]: Piwik\\Plugins\\API\\Controller-&gt;index() #30 \/var\/www\/html\/core\/FrontController.php(645): call_user_func_array(Array, Array) #31 \/var\/www\/html\/core\/FrontController.php(169): Piwik\\FrontController-&gt;doDispatch('API', false, Array) #32 \/var\/www\/html\/core\/dispatch.php(33): Piwik\\FrontController-&gt;dispatch() #33 \/var\/www\/html\/index.php(25): require_once('\/var\/www\/html\/c...') #34 \/var\/www\/html\/core\/CliMulti\/RequestCommand.php(76): require_once('\/var\/www\/html\/i...') #35 \/var\/www\/html\/core\/Plugin\/ConsoleCommand.php(138): Piwik\\CliMulti\\RequestCommand-&gt;doExecute() #36 \/var\/www\/html\/vendor\/symfony\/console\/Command\/Command.php(298): Piwik\\Plugin\\ConsoleCommand-&gt;execute(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #37 \/var\/www\/html\/core\/Plugin\/ConsoleCommand.php(153): Symfony\\Component\\Console\\Command\\Command-&gt;run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #38 \/var\/www\/html\/vendor\/symfony\/console\/Application.php(1040): Piwik\\Plugin\\ConsoleCommand-&gt;run(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #39 \/var\/www\/html\/vendor\/symfony\/console\/Application.php(301): Symfony\\Component\\Console\\Application-&gt;doRunCommand(Object(Piwik\\CliMulti\\RequestCommand), Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #40 \/var\/www\/html\/core\/Console.php(113): Symfony\\Component\\Console\\Application-&gt;doRun(Object(Symfony\\Component\\Console\\Input\\ArgvInput), Object(Symfony\\Component\\Console\\Output\\ConsoleOutput)) #41 [internal function]: Piwik\\Console-&gt; ... )\n#21 \/var\/www\/html\/console(32): Symfony\\Component\\Console\\Application->run()\n#22 {main}"}'
INFO      [2026-01-23 06:07:56] 12  Skipped Archiving website id 14, period = week, date = 2026-01-19, segment = 'pageUrl=@%2Fessential%2F', 0 visits found. Time elapsed: 2.069s
...
ERROR     [2026-01-23 09:29:47] 12  18 total errors during this script execution, please investigate and try and fix these errors.
ERROR     [2026-01-23 09:29:47] 12  Uncaught exception: /var/www/html/core/CronArchive.php(648): 18 total errors during this script execution, please investigate and try and fix these errors. [Query: , CLI mode: 1]

In CronArchive.php line 648:
                                                                               
  18 total errors during this script execution, please investigate and try an  
  d fix these errors.                                                          
                                                                               

core:archive [--url URL] [--skip-idsites [SKIP-IDSITES]] [--skip-all-segments] [--force-idsites [FORCE-IDSITES]] [--skip-segments-today] [--force-periods [FORCE-PERIODS]] [--force-date-last-n [FORCE-DATE-LAST-N]] [--force-date-range [FORCE-DATE-RANGE]] [--force-idsegments FORCE-IDSEGMENTS] [--concurrent-requests-per-website [CONCURRENT-REQUESTS-PER-WEBSITE]] [--concurrent-archivers [CONCURRENT-ARCHIVERS]] [--max-websites-to-process MAX-WEBSITES-TO-PROCESS] [--max-archives-to-process MAX-ARCHIVES-TO-PROCESS] [--disable-scheduled-tasks] [--accept-invalid-ssl-certificate] [--php-cli-options [PHP-CLI-OPTIONS]] [--force-all-websites] [--force-report [FORCE-REPORT]]

Archiving failed

Validations

Metadata

Metadata

Assignees

No one assigned

    Labels

    Potential BugSomething that might be a bug, but needs validation and confirmation it can be reproduced.To TriageAn issue awaiting triage by a Matomo core team member

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions