What happened?
When core:archive is executed by a cron job wrapped with flock and shell processes, Matomo incorrectly counts the wrapper processes as separate concurrent archivers.
The cron job creates a process tree similar to:
/bin/sh
-> /usr/bin/flock
-> /bin/bash
-> php83 .../matomo/console core:archive
Only the final PHP process is an actual Matomo archiver.
However, in core/CronArchive.php, hasReachedMaxConcurrentArchivers() counts every process whose command line contains both:
strpos($process, ' core:archive') !== false &&
strpos($process, 'console ') !== false
Since the parent shell and flock processes contain the complete child command in their arguments, all four processes match.
Matomo therefore reports:
Archiving will stop now because 4 archivers are already running and max 3 are supposed to run at once.
Reached maximum concurrent archivers allowed (3), aborting run.
The same core:archive command executed directly from the shell works normally and reports:
1 out of 3 archivers running currently
This occurs on Hetzner hosting, where frequent cron jobs are wrapped/protected with flock to prevent overlapping executions.
Related discussion about Hetzner's cron/flock requirement:
contao/contao#9404
What should happen?
A single core:archive invocation should be counted as one concurrent archiver, regardless of whether it is started through cron, flock, or shell wrapper processes.
Matomo should distinguish the actual PHP core:archive process from parent processes whose command-line arguments merely contain the text console core:archive.
The current behavior prevents scheduled report archiving from running, even though only one real Matomo archiver exists.
As a workaround, moving the actual core:archive command into a separate executable shell script and having flock execute only that script prevents the wrapper processes from containing console core:archive.
How can this be reproduced?
Configure a cron job where core:archive is executed through flock and a shell, for example:
05 * * * * '/usr/bin/flock' -n -E 0 '/path/to/archive.lck' '/bin/bash' -c '/usr/bin/php /path/to/matomo/console core:archive --url="https://stats.example.com/" >> /path/to/matomo-archive.log'
When the cron job runs, inspect matching processes:
ps -eo pid,ppid,args | grep 'core:archive' | grep 'console '
In our case one cron execution produced:
80572 80569 /bin/sh -c '/usr/bin/flock' ... '/bin/bash' -c '/usr/bin/php .../matomo/console core:archive ...'
80575 80572 /usr/bin/flock ... /bin/bash -c /usr/bin/php .../matomo/console core:archive ...
80577 80575 /bin/bash -c /usr/bin/php .../matomo/console core:archive ...
80580 80577 php83 ... /matomo/console core:archive ...
There is only one actual PHP archiver, but all four command lines contain console core:archive.
Matomo then reports:
Archiving will stop now because 4 archivers are already running and max 3 are supposed to run at once.
Reached maximum concurrent archivers allowed (3), aborting run.
For comparison, running the underlying command directly:
/usr/bin/php /path/to/matomo/console core:archive --url="https://stats.example.com/"
results in:
1 out of 3 archivers running currently
and archiving completes successfully.
Matomo version
5.13.0
PHP version
8.3
Server operating system
Debian GNU/Linux 12 (bookworm)
What browsers are you seeing the problem on?
No response
Computer operating system
No response
Relevant log output
INFO [2026-08-28 10:05:02] 80580 Running Matomo 5.13.0 as Super User
INFO [2026-08-28 10:05:02] 80580 Async process archiving supported, using CliMulti.
INFO [2026-08-28 10:05:02] 80580 Starting Matomo reports archiving...
INFO [2026-08-28 10:05:02] 80580 Archiving will stop now because 4 archivers are already running and max 3 are supposed to run at once.
INFO [2026-08-28 10:05:02] 80580 Reached maximum concurrent archivers allowed (3), aborting run.
Process list captured during the same cron invocation:
80572 80569 /bin/sh -c '/usr/bin/flock' ... '/bin/bash' -c '/usr/bin/php .../matomo/console core:archive ...'
80575 80572 /usr/bin/flock ... /bin/bash -c /usr/bin/php .../matomo/console core:archive ...
80577 80575 /bin/bash -c /usr/bin/php .../matomo/console core:archive ...
80580 80577 php83 ... /matomo/console core:archive ...
Validations
What happened?
When
core:archiveis executed by a cron job wrapped withflockand shell processes, Matomo incorrectly counts the wrapper processes as separate concurrent archivers.The cron job creates a process tree similar to:
Only the final PHP process is an actual Matomo archiver.
However, in
core/CronArchive.php,hasReachedMaxConcurrentArchivers()counts every process whose command line contains both:Since the parent shell and
flockprocesses contain the complete child command in their arguments, all four processes match.Matomo therefore reports:
The same
core:archivecommand executed directly from the shell works normally and reports:This occurs on Hetzner hosting, where frequent cron jobs are wrapped/protected with
flockto prevent overlapping executions.Related discussion about Hetzner's cron/flock requirement:
contao/contao#9404
What should happen?
A single
core:archiveinvocation should be counted as one concurrent archiver, regardless of whether it is started throughcron,flock, or shell wrapper processes.Matomo should distinguish the actual PHP
core:archiveprocess from parent processes whose command-line arguments merely contain the textconsole core:archive.The current behavior prevents scheduled report archiving from running, even though only one real Matomo archiver exists.
As a workaround, moving the actual
core:archivecommand into a separate executable shell script and havingflockexecute only that script prevents the wrapper processes from containingconsole core:archive.How can this be reproduced?
Configure a cron job where
core:archiveis executed throughflockand a shell, for example:When the cron job runs, inspect matching processes:
In our case one cron execution produced:
There is only one actual PHP archiver, but all four command lines contain
console core:archive.Matomo then reports:
For comparison, running the underlying command directly:
/usr/bin/php /path/to/matomo/console core:archive --url="https://stats.example.com/"results in:
and archiving completes successfully.
Matomo version
5.13.0
PHP version
8.3
Server operating system
Debian GNU/Linux 12 (bookworm)
What browsers are you seeing the problem on?
No response
Computer operating system
No response
Relevant log output
Validations