Nextcloud version (eg, 20.0.5): 25.0.3
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04
Apache or nginx version (eg, Apache 2.4.25): Apache 2.4.41
PHP version (eg, 7.4): 8.1
The issue you are facing:
When running the nextcloud cron job, I see the following in the log:
CRON[1083249]: (www-data) CMD (PHP_MEMORY_LIMIT=3000M cronic php -f /var/www/nextcloud/cron.php)
Feb 14 12:45:44 ed-mh-x86001 Nextcloud[1076417]: {"reqId":"1enS1bxafYGtQvM53sCv","level":3,"time":"2023-02-14T12:45:44+00:00","remoteAddr":"10.126.172.18","user":"<redacted_user_name>","app":"PHP","method":"PROPFIND","url":"/remote.php/dav/files/<redacted_user_name>/Field-Data/wind/<redacted>/<redacted>/2021","message":"Allowed memory size of 1073741824 bytes exhausted (tried to allocate 20480 bytes) at /var/www/nextcloud/lib/private/L10N/Factory.php#129","userAgent":"Mozilla/5.0 (Windows) mirall/3.4.1stable-Win64 (build 20211221) (Nextcloud, windows-10.0.19045 ClientArchitecture: x86_64 OsArchitecture: x86_64)","version":"25.0.3.2","data":{"app":"PHP"}}
The folder in question <redacted_user_name>/Field-Data/wind/<redacted>/<redacted>/2021
contains thousands of very small files. The root folder (Field-Data
) is an external folder on a linux SMB share, and is read-ony.
I’ve tried really hard to increase the php memory limit to 3000M, by changing memory_limit
in the following files:
/etc/php/8.1/cli/php.ini
/etc/php/8.1/apache2/php.ini
/etc/php/8.1/fpm/php.ini
(I have set up HTTP2 and am therefore using php-fpm).
And also modifying the call to php in the cron job line, as you can see above, by trying to set the PHP_MEMORY_LIMIT
environment variable. It still hits the memory limit at 1073741824 bytes.
In all the above files I have also set apc.enable_cli=1
, and have also added it to the following files.
/etc/php/8.1/cli/conf.d/20-apcu.ini
/etc/php/8.1/apache2/conf.d/20-apcu.ini
/etc/php/8.1/fpm/conf.d/20-apcu.ini
In case it’s relevant I’m using the Client Push app.
My question is, how can I increase the memory limit, and separately what is the real root cause of this error?
Is this the first time you’ve seen this error? (Y/N): Y (first time I’ve noticed)
The output of my config.php file):
<?php
$CONFIG = array (
'passwordsalt' => ''<redacted>',
'secret' => ''<redacted>,
'trusted_domains' =>
array (
0 => 'localhost',
1 => '<redacted>',
2 => 'nextcloud.<redacted>',
),
'datadirectory' => '/mnt/'<redacted>/nextcloud-data',
'dbtype' => 'mysql',
'version' => '25.0.3.2',
'overwrite.cli.url' => 'https://'<redacted>',
'dbname' => 'nextcloud',
'dbhost' => 'localhost',
'dbport' => '',
'dbtableprefix' => 'oc_',
'dbuser' => 'nextcloud',
'dbpassword' => ''<redacted>',
'installed' => true,
'instanceid' => ''<redacted>',
'maintenance' => false,
'memcache.local' => '\\OC\\Memcache\\APCu',
'memcache.distributed' => '\\OC\\Memcache\\Redis',
'memcache.locking' => '\\OC\\Memcache\\Redis',
'redis' =>
array (
'host' => '/var/run/redis/redis-server.sock',
'port' => 0,
'password' => ''<redacted>',
'timeout' => 1.5,
),
'mail_from_address' => 'nextcloud',
'mail_smtpmode' => 'smtp',
'mail_sendmailmode' => 'smtp',
'mail_domain' => ''<redacted>',
'mail_smtpauthtype' => 'LOGIN',
'mail_smtpauth' => 1,
'mail_smtphost' => ''<redacted>',
'mail_smtpport' => '465',
'mail_smtpname' => ''<redacted>',
'mail_smtppassword' => ''<redacted>',
'mail_smtpsecure' => 'ssl',
'theme' => '',
'log_type' => 'syslog',
'syslog_tag' => 'Nextcloud',
'logfile' => '',
'loglevel' => 3,
'ldapIgnoreNamingRules' => false,
'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
'mysql.utf8mb4' => true,
'default_phone_region' => 'GB',
'trusted_proxies' =>
array (
0 => '127.0.0.1',
1 => '::1',
2 => '<redacted>',
),
'overwriteprotocol' => 'https',
);
EDIT
Setting the cron command to be
PHP_MEMORY_LIMIT=3000M cronic php -d memory_limit=3000M -f /var/www/nextcloud/cron.php
seems to have gotten rid of the error for me, but I still would like to kno why the other things didn’t work in case there is something I’m missing.