Running php gets killed

Received an update for version 21.0.1, there were no errors upgrading (few apps disabled: Deck, Bruteforcesetting, Breeze-Dark).
After update noticed background jobs not working (using cron), and there is warning about updating db indices.
I tried executing sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices
However it ends in:
killed sudo -u www-data php /var/www/nextcloud/occ db:add-missing-indices no more info, which log file should I check for errors/issues? Or is there higher verbosity?

2 Likes

just checked dmesg and command was getting killed due to out of memory, VPS has 4GB and my php.ini always had memory_limit = -1, I’ve changed this to memory_limit = 2048M. (restarted apache after this)

Even that is being killed.
I wanted to know has there any change in version 21 related to this, or something on my end changed? And how do I fix it?

Hey @wizkid

It looks like your php-cli command is not using the php.ini you made your changes in. Try the following command, to dynamically assign a memory_limit just for the execution of your script:

sudo -u www-data php -d memory_limit=2048M /var/www/nextcloud/occ db:add-missing-indices

This way you should be able to execute the script in question, without it being killed.

EDIT: This could help as well (OOM when running occ db:add-missing-indices after upgrade to NC 21 - #4 by Dampfklon)

I was using modular config system (there is memcache.config.php under config)
I removed APCu entry from there, managed to get db indices and background jobs running again.
PHP is not getting killed. I’ll figure out how to enable memory caching from other thread

Thanks
[EDIT above this line]
that fails as well, even tried 3072M

sudo -u www-data php -d memory_limit=3072M /var/www/nextcloud/occ db:add-missing-indices

PHP Fatal error:  Allowed memory size of 3221225472 bytes exhausted (tried to allocate 20480 bytes) in /var/www/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 133

On other hand I’ve removed APCu from config in my environment, however still stuck on indices part

Hi @wizkid

I had the same issue.

I fixed it by adding the line “apc.enable_cli=1” to my /etc/php/7.4/cli/conf.d/20-apcu.ini. (See NC 21 - No OCC Output after upgrade - #2 by tflidd). Working fine now.

I had also tried to remove ‘memcache.local’ => ‘\OC\Memcache\APCu’, from Netxcloud config (See OOM when running occ db:add-missing-indices after upgrade to NC 21 - #4 by Dampfklon). It worked but then I was getting a warning saying it would be better to have a cache enabled. So I rolled that change back.

2 Likes

thanks that worked

I had the same issue! Thank you for your report and for the fix (apc.enable_cli=1), you saved my whole weekend!

I am very interested, whether the nextcloud core team can find a way to fix the issue generally, if possible.