Nextcloud version (11.0.3.2) upgraded from ownCloud 9
Operating system and version (Ubuntu 16.04)
Apache version (Apache 2.4.18)
PHP version (7.0)
Is this the first time you’ve seen this error? yes, with Nextcloud, not happend with ownCloud
Can you reliably replicate it?
It happens all the time you run files:scan --all
Also, if I ran cron.php from command line or automatically when cron job runs, it works and exits without error, but sometimes I get a server alarm I set and tells me memory is almost full, I look for processes running and cron.php is consuming about 14GB ram, so I kill it. Run it manually… and it goes good.
The other thing is the oc_filecache table about 17GB… something might be wrong? I have only my user and my files, I am a normal user, movies, games, programs… everything is about 2TB.
I have configured external storages from my nextcloud user interface, and connected 5 folders (inside my sata disk, ie /mnt/disk1/folder1, folder2, folder3, music, movies) with SFTP, and also my complete data disk mounted as /mnt/disk1.
The issue you are facing:
When I run “occ scan:files --all” it starts scanning, some time later you get: PHP Fatal error: Allowed memory size of 536870912 bytes exhausted
I also noticed one time, running cron.php consumes up to 14GB ram memory and mysql oc_filecache up to 17GB disk space, but this should have something to do with the previous error (php loop?)
The output of your Nextcloud log
its my nextcloud.log file, not the complete file but almost, if it is needed I can re-paste it fully.
https://pastebin.com/wXUBNPT4
The output of your config.php file in /path/to/nextcloud:
> <?php
> $CONFIG = array (
> ‘updatechecker’ => false,
> ‘instanceid’ => ‘xxxxxxxxxx’,
> ‘passwordsalt’ => ‘xxxxxxxxxxxxxxxxxxx’,
> ‘secret’ => ‘xxxxxxxxxxxxx’,
> ‘trusted_domains’ =>
> array (
> 0 => ‘20.0.0.100’,
> 1 => ‘myexternalip’,
> 2 => ‘localhost’,
> ),
> ‘datadirectory’ => ‘/mnt/DISCO1/home/nextcloud/data’,
> ‘overwrite.cli.url’ => ‘/nextcloud’,
> ‘htaccess.RewriteBase’ => ‘/nextcloud’,
> ‘dbtype’ => ‘mysql’,
> ‘version’ => ‘11.0.3.2’,
> ‘dbname’ => ‘owncloud’,
> ‘dbhost’ => ‘localhost’,
> ‘dbtableprefix’ => ‘oc_’,
> ‘dbuser’ => ‘user’,
> ‘dbpassword’ => ‘xxxxxxxxxxxx’,
> ‘logtimezone’ => ‘UTC’,
> ‘installed’ => true,
> ‘loglevel’ => 3,
> ‘mail_from_address’ => ‘myemailname’,
> ‘mail_smtpmode’ => ‘smtp’,
> ‘mail_domain’ => ‘gmail.com’,
> ‘mail_smtpauthtype’ => ‘LOGIN’,
> ‘mail_smtphost’ => ‘smtp.gmail.com’,
> ‘mail_smtpport’ => ‘465’,
> ‘mail_smtpauth’ => 1,
> ‘mail_smtpsecure’ => ‘ssl’,
> ‘mail_smtpname’ => ‘myemail@gmail.com’,
> ‘mail_smtppassword’ => ‘pass’,
> ‘maintenance’ => true,
> ‘data-fingerprint’ => ‘xxxxxxxxxxxxxxxx’,
> ‘theme’ => ‘’,
> ‘memcache.local’ => ‘\OC\Memcache\APCu’,
> ‘default_language’ => ‘en’,
> ‘ldapIgnoreNamingRules’ => false,
> ‘ldapProviderFactory’ => ‘\OCA\User_LDAP\LDAPProviderFactory’,
> ‘updater.release.channel’ => ‘stable’,
> );
The output of your Apache log:
(I can paste it fully if asked)
https://pastebin.com/snBFWDub
I have backups, but for now I think I will try to empty the oc_filecache table and try a occ files:scan --all again.
I would also like to add the last files:scan --all output just after the server gets almost out of ram:
> Scanning files for 2 users
> Starting scan for user 1 out of 2 (admin)
> Starting scan for user 2 out of 2 (myusername)
> PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 20480 bytes) in /mnt/DISCO1/home/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php on line 91
> PHP Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2014 Cannot execute queries while other unbuffered queries are active. Consider using PDOStatement::fetchAll(). Alternatively, if your code is only ever going to run against mysql, you may enable query buffering by setting the PDO::MYSQL_ATTR_USE_BUFFERED_QUERY attribute. in /mnt/DISCO1/home/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:91
> Stack trace:
> /mnt/DISCO1/home/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(91): PDOStatement->execute(Array)
> /mnt/DISCO1/home/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(989): Doctrine\DBAL\Driver\PDOStatement->execute(Array)
> mnt/DISCO1/home/nextcloud/lib/private/DB/Connection.php(215): Doctrine\DBAL\Connection->executeUpdate(‘UPDATE oc_file...', Array, Array) > /mnt/DISCO1/home/nextcloud/lib/private/Lock/DBLockingProvider.php(203): OC\DB\Connection->executeUpdate('UPDATE
oc_file…’, Array)
> /mnt/DISCO1/home/nextcloud/lib/ in /mnt/DISCO1/home/nextcloud/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractMySQLDriver.php on line 116
Thank you very much!
S.
OK, I truncated the oc_filecache table (I read somewhere that I should not touch that table… but :-x), firstly I set nextcloud in maintenance mode just in case it helps. Restarted mysql and apache.
Now the table is about 250mb, seems ok… I ran again the files:scan --all command and this is the output:
> sudo -u www-data php occ files:scan --all
> Scanning files for 2 users
> Starting scan for user 1 out of 2 (admin)
> Starting scan for user 2 out of 2 (sebadamus)
> PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 18874368 bytes) in /mnt/DISCO1/home/nextcloud/lib/private/Lock/DBLockingProvider.php on line 76
> PHP Fatal error: Allowed memory size of 536870912 bytes exhausted (tried to allocate 8388616 bytes) in /mnt/DISCO1/home/nextcloud/lib/private/Lock/DBLockingProvider.php on line 263
Searching in San Google, the PHP Fatal error: Allowed memory… (normaly is 128mb as default, but I give it more just in case, about 512mb to test so thats why the value incresed from normal default value. But the error apears again. Seems PHP code is going crazy or looping somewhere.
The line 76 in file DBLockingProvider.php is if ($type === self::LOCK_SHARED) {
> /**
> * Mark a locally acquired lock
> *
> * @param string $path
> * @param int $type self::LOCK_SHARED or self::LOCK_EXCLUSIVE
> */
> protected function markAcquire($path, $type) {
> parent::markAcquire($path, $type);
> if ($type === self::LOCK_SHARED) {
> $this->sharedLocks[$path] = true;
> }
> }
And the 263 is: $lockedPaths = array_keys($this->sharedLocks);
> /**
> * release all lock acquired by this instance which were marked using the mark* methods
> */
> public function releaseAll() {
> parent::releaseAll();
> // since we keep shared locks we need to manually clean those
> $lockedPaths = array_keys($this->sharedLocks);
> $lockedPaths = array_filter($lockedPaths, function ($path) {
> return $this->sharedLocks[$path];
> });
Hope someone give some light on this…
Thanks!