Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] archive causes php memory limit warning #22447

Closed
4 tasks done
Tassleh0ff opened this issue Jul 27, 2024 · 1 comment
Closed
4 tasks done

[Bug] archive causes php memory limit warning #22447

Tassleh0ff opened this issue Jul 27, 2024 · 1 comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member

Comments

@Tassleh0ff
Copy link

What happened?

Launching a cronjob to auto-archive my matomo site returns this error

Error: Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2024-07-26&format=json&trigger=archivephp: 'PHP Warning: Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0 {"idarchives":[3551],"nb_visits":6}'

What should happen?

Archive cronjob should run with no errors reported on stderr

How can this be reproduced?

Launching this command
/usr/local/bin/php /var/www/html/console core:archive --url=https://mysite.domain.tld/"

Matomo version

5.1.0

PHP version

8.1.29

Server operating system

Debian GNU/Linux 12

What browsers are you seeing the problem on?

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

Computer operating system

Windows 11 Pro 23H2

Relevant log output

root@kenderpi5:/data/docker/www-statistics# /usr/bin/docker exec -i www-statistics-web su -s "/bin/bash" -c "/usr/local/bin/php /var/www/html/console core:archive --url=https://mysite.domain.tld/"
PHP Warning:  Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
INFO      [2024-07-27 09:31:14] 913  ---------------------------
INFO      [2024-07-27 09:31:14] 913  INIT
INFO      [2024-07-27 09:31:14] 913  Running Matomo 5.1.0 as Super User
INFO      [2024-07-27 09:31:14] 913  ---------------------------
INFO      [2024-07-27 09:31:14] 913  NOTES
INFO      [2024-07-27 09:31:14] 913  - Async process archiving supported, using CliMulti.
INFO      [2024-07-27 09:31:14] 913  - Reports for today will be processed at most every 900 seconds. You can change this value in Matomo UI > Settings > General Settings.
INFO      [2024-07-27 09:31:14] 913  - Archiving was last executed without error 1 days 4 hours ago.
INFO      [2024-07-27 09:31:14] 913  ---------------------------
INFO      [2024-07-27 09:31:14] 913  START
INFO      [2024-07-27 09:31:14] 913  Starting Matomo reports archiving...
INFO      [2024-07-27 09:31:14] 913  0 out of 3 archivers running currently
INFO      [2024-07-27 09:31:14] 913  Start processing archives for site 1.
INFO      [2024-07-27 09:31:14] 913    Will invalidate archived reports for today in site ID = 1's timezone (2024-07-27 00:00:00).
INFO      [2024-07-27 09:31:14] 913    Will invalidate archived reports for yesterday in site ID = 1's timezone (2024-07-26 00:00:00).
INFO      [2024-07-27 09:31:14] 913  'PHP Warning:  Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0
{"idarchives":[3551],"nb_visits":6}'
ERROR     [2024-07-27 09:31:15] 913  Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2024-07-26&format=json&trigger=archivephp: 'PHP Warning:  Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0 {"idarchives":[3551],"nb_visits":6}'
INFO      [2024-07-27 09:31:15] 913  Finished archiving for site 1, 1 API requests, Time elapsed: 0.257s [1 / 1 done]
INFO      [2024-07-27 09:31:15] 913  Done archiving!
INFO      [2024-07-27 09:31:15] 913  ---------------------------
INFO      [2024-07-27 09:31:15] 913  SUMMARY
INFO      [2024-07-27 09:31:15] 913  Processed 0 archives.
INFO      [2024-07-27 09:31:15] 913  Total API requests: 1
INFO      [2024-07-27 09:31:15] 913  done: 1 req, 296 ms, 1 errors.
INFO      [2024-07-27 09:31:15] 913  Time elapsed: 0.297s
INFO      [2024-07-27 09:31:15] 913  ---------------------------
INFO      [2024-07-27 09:31:15] 913  SCHEDULED TASKS
INFO      [2024-07-27 09:31:15] 913  Starting Scheduled tasks...
INFO      [2024-07-27 09:31:15] 913  done
INFO      [2024-07-27 09:31:15] 913  ---------------------------
INFO      [2024-07-27 09:31:15] 913  ---------------------------
INFO      [2024-07-27 09:31:15] 913  SUMMARY OF ERRORS
INFO      [2024-07-27 09:31:15] 913  Error: Error unserializing the following response from ?module=API&method=CoreAdminHome.archiveReports&idSite=1&period=day&date=2024-07-26&format=json&trigger=archivephp: 'PHP Warning:  Failed to set memory limit to 0 bytes (Current memory usage is 2097152 bytes) in Unknown on line 0 {"idarchives":[3551],"nb_visits":6}'
ERROR     [2024-07-27 09:31:15] 913  1 total errors during this script execution, please investigate and try and fix these errors.
ERROR     [2024-07-27 09:31:15] 913  Uncaught exception: /var/www/html/core/CronArchive.php(648): 1 total errors during this script execution, please investigate and try and fix these errors. [Query: , CLI mode: 1]

In CronArchive.php line 648:

  1 total errors during this script execution, please investigate and try and
   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]]

Validations

@Tassleh0ff Tassleh0ff added Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member labels Jul 27, 2024
@Tassleh0ff
Copy link
Author

I found the error, memory_limit was not set and by default it took 128MB, I rised its value to 2048MB via an env variable to my apache-php-fpm container and archive started working again.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Potential Bug Something that might be a bug, but needs validation and confirmation it can be reproduced. To Triage An issue awaiting triage by a Matomo core team member
Projects
None yet
Development

No branches or pull requests

1 participant