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

PHP Fatal error: Allowed memory size exhausted on cron job #1735

Closed
wwwdesign opened this issue Apr 12, 2023 · 6 comments
Closed

PHP Fatal error: Allowed memory size exhausted on cron job #1735

wwwdesign opened this issue Apr 12, 2023 · 6 comments
Labels
0. Needs triage Pending approval or rejection. This issue is pending approval. bug Something isn't working

Comments

@wwwdesign
Copy link

wwwdesign commented Apr 12, 2023

Describe the bug
I'm getting repeatedly error warnings from the Cron Daemon:

PHP Fatal error:  Allowed memory size of 134217728 bytes exhausted (tried to allocate 528384 bytes) in /var/www/vhosts/mysite.net/cloudy/apps/photos/vendor/hexogen/kdtree/src/ItemList.php on line 49

To Reproduce
Steps to reproduce the behavior:

  1. Wait for cron to run

Expected behavior
Cron daemon running without error

Server (please complete the following information):

  • Version 26
  • PHP 8.1.17
  • memory_limit 512M

Additional context
Error appeared last friday for the first time

@wwwdesign wwwdesign added 0. Needs triage Pending approval or rejection. This issue is pending approval. bug Something isn't working labels Apr 12, 2023
@nicrame
Copy link

nicrame commented May 10, 2023

What is Your PHP memory limit (memory_limit in php.ini)? If it's low try to make it higher like 512MB.

@joshtrichards
Copy link
Member

Cron uses the CLI PHP configuration. Your PHP memory_limit may be 512M for the Web PHP, but it is set to 128M for your CLI PHP (per that error message). You'll need to fix your PHP configuration.

If you get stuck changing it, visit the Nextcloud Help Forum.

This isn't a Photos app bug. This issue can be closed out.

@tegger2000
Copy link

hi, i had the same problem. add "-dmemory_limit=-1" to your cron job, i.e. "/usr/local/php81/bin/php -dmemory_limit=-1 occ photos:update-1000-cities"

@Sedeniono
Copy link

I am running a small private nextcloud instance in a shared hosting environment. I also saw the following lines when background jobs were run:

"Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) at <nc path>/apps/photos/lib/Service/ReverseGeoCoderService.php#151"
"Allowed memory size of 134217728 bytes exhausted (tried to allocate 4096 bytes) at <nc path>/apps/photos/vendor/hexogen/kdtree/src/Point.php#20"

They appeared after I uploaded some geotagged photos. Deleting the photos fixed the problem. Alternatively, disabling the photo app also "fixed" the issue (but, of course, then the app is no longer available).

As explained in the posts above, the issue is, of course, insufficient memory. The thing is: Without upgrading to a more expensive shared hosting plan, I am stuck with 128MB of memory. So I cannot increase it by simply editing some php configuration or cron job. And for my single-user use case it was sufficient till now. Is there maybe some way to disable the geotagging feature of the photos app?

Also note: The minimum memory according to the nextcloud manual is 128MB, so I would expect the photos app to work with that. So one might actually argue it is a photos app bug (or, alternatively, the manual needs to be updated).

@joshtrichards
Copy link
Member

Is there maybe some way to disable the geotagging feature of the photos app?

occ config:app:set --value='1' photos disable_places should work in the latest Photos within v29.

Also note: The minimum memory according to the nextcloud manual is 128MB, so I would expect the photos app to work with that. So one might actually argue it is a photos app bug (or, alternatively, the manual needs to be updated).

That's the minimum that is even viable, but >=512 is recommended. It also says memory needs vary greatly depending on apps/etc. :-)

@joshtrichards joshtrichards closed this as not planned Won't fix, can't repro, duplicate, stale May 1, 2024
@joshtrichards
Copy link
Member

@Sedeniono Doc clarification pending for memory constrained environments. Thanks for pointing that out: nextcloud/documentation#11775

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
0. Needs triage Pending approval or rejection. This issue is pending approval. bug Something isn't working
Projects
None yet
Development

No branches or pull requests

5 participants