FS#69726 - [nextcloud] Running occ command php fatal error
Attached to Project:
Community Packages
Opened by Jonas Heinrich (onny) - Sunday, 21 February 2021, 09:29 GMT
Last edited by David Runge (dvzrv) - Tuesday, 23 February 2021, 11:10 GMT
Opened by Jonas Heinrich (onny) - Sunday, 21 February 2021, 09:29 GMT
Last edited by David Runge (dvzrv) - Tuesday, 23 February 2021, 11:10 GMT
|
Details
Description:
Since upgrading to Nextcloud 21 I get following error trying to run ./occ or any php file inside the Nextcloud directory: $ sudo -u http ./occ update PHP Warning: Module “gd” is already loaded in Unknown on line 0 PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 133 This bug occours with php8 and php7 :/ Somehow Nextcloud is running fine through php-fpm and Caddy as web frontend. Additional info: * package version(s): nextcloud 21.0.0-4 * config and/or log files etc. https://help.nextcloud.com/t/occ-command-php-fatal-error-allowed-memory-size-of-xxx-bytes-exhausted/108521 * link to upstream bug report, if any https://help.nextcloud.com/t/occ-command-php-fatal-error-allowed-memory-size-of-xxx-bytes-exhausted/108521 Would be happy if someone got some clues for debugging :) Regareds Jonas |
This task depends upon
Closed by David Runge (dvzrv)
Tuesday, 23 February 2021, 11:10 GMT
Reason for closing: Fixed
Additional comments about closing: The problem is related to php-apcu based caching. A warning has been added to the wiki:
https://wiki.archlinux.org/index.php/Nex tcloud#Using_the_ownCloud_console
Tuesday, 23 February 2021, 11:10 GMT
Reason for closing: Fixed
Additional comments about closing: The problem is related to php-apcu based caching. A warning has been added to the wiki:
https://wiki.archlinux.org/index.php/Nex tcloud#Using_the_ownCloud_console
Please note, that the application now needs to be run as its own user (nextcloud).
Please check whether nextcloud >= 21.0.0-6 in [community-testing] fixes this for you.
NOTE: Please be aware, that that version also introduces other changes, that are necessary to fix the situation with the config directory [1] (basically reverting to pre 21.0.0 behavior in regards to location/ symlinking of the configuration).
[1] https://bugs.archlinux.org/task/69718#comment196955
[1] https://wiki.archlinux.org/index.php/Nextcloud#Issues_with_permissions_and_setup_after_upgrade_to_%3E=_21.0.0
This one is really tricky ^^ Upgraded to 21.0.0-6 and /etc/webapps/nextcloud & /var/lib/nextcloud is now owned by the user and group nextcloud.
occ is still failing :(
root@http /u/s/w/nextcloud [255]# pwd
/usr/share/webapps/nextcloud
root@http /u/s/w/nextcloud# /usr/bin/occ
PHP Warning: Module "gd" is already loaded in Unknown on line 0
PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /usr/share/webapps/nextcloud/lib/private/AppFramework/Utility/SimpleContainer.php on line 133
I also configured a php-fpm pool with the nextcloud user for the web server but it doesn't seem to work yet. Still figuring out. Nothing added to the nextcloud.log, only 404 in Caddy log trying to access / and no php errors :(
a) set up another vhost running suexec nextcloud and change the url in all places
b) use my own PKGBUILD from now on
or do I miss some other option?
@marlemion: If you don't have anything constructive to add to this specific ticket, please leave your remarks somewhere else. If you have a specific problem to discuss, open a ticket on your own, but please don't hijack other people's tickets.
In case it helps somehow, here is the output of php -i https://pastebin.com/mubcQy2p
But I really guess this is somehow related to an internal Nextcloud bug. There are other people with other systems having similar issues https://help.nextcloud.com/t/nextcloud-consuming-all-memory-and-swap-and-crashing-server/108532
Thinking about creating an upstream ticket :/
Still wondering why php-fpm had no issues rendering index.php etc. whereas php on the command line throws this error on every single php file inside Nextcloud directory :/
I can add that the same issue occurs with cron.php.
PHP-FPM seems to work fine on my end, it's just with PHP CLI that this issue happens. It also seems to be specific to Nextcloud
Could not resolve OC\User\Manager!
Could not resolve OC\Security\CSRF\CsrfTokenManager!
As if it was unable to locate its lib/private/ folder.
If I set memory_limit to -1, it fill completely memory and hit OOMkiller.
(tried with both php7 and php8, with nextcloud-21.0.0-7)
I just wanted to make sure, that you are aware of my first comment to this ticket [1] in which I mention the requirement for the application (and this also includes the occ command!) to be run as the nextcloud user.
As a convenience wrapper I have added the /usr/bin/occ script, which automatically calls /usr/share/webapps/nextcloud/occ with the correct user (but offers the possibility to override what/how /usr/share/webapps/nextcloud/occ is called using $NEXTCLOUD_USER, $NEXTCLOUD_PHP and $NEXTCLOUD_PHP_CONFIG).
This change is explained in detail in the wiki [2] now as well. However, the new occ wrapper script is not yet covered in the article.
[1] https://bugs.archlinux.org/task/69726#comment196963
[2] https://wiki.archlinux.org/index.php/Nextcloud#Issues_with_permissions_and_setup_after_upgrade_to_%3E=_21.0.0
You may not want to do this--- but what I had to do was do a new fresh install (all previous packages and dependencies deleted, including all folders left behind).
Once I did a fresh install of PHP 8 and nextcloud, and followed the guide closely, everything worked again.
Larry
This indeed points to some misconfiguration somewhere in the php.ini then I guess.
Sorry I can not be of much more help :-/
[1] https://github.com/nextcloud/server/issues/25742#issuecomment-783490277
https://github.com/nextcloud/server/issues/25742#issuecomment-783553193
Adding "apc.enable_cli=1" to php.ini solved it for me :)
Thanks to everyone for the support!