Nextcloud app crashes

Nextcloud version: 22.2.6
Operating system and version: Ubuntu 20.04.3 LTS
Apache or nginx version: Apache 2.4.51
PHP version : 7.4.26
Nextcloud app version: 3.4.0 (Windows)

The issue you are facing:
We have a fileserver based on Windows Server 2019 Standard with shared folder “Dubai” on it. It is connected to our Nextcloud as External Storage (SMB), has a lot of subfolders and its size is 22GB total.
So the problem is that when I use Nextcloud via app, the app crashes with no error after 20-30 min in the middle of syncing. If I create a new user and this user tries to sync via app, it crashes with no error too.
The second problem is that one time my colleague was able to sync almost all our folders. But it ended up messed. A lot of subfolders just moved one folder higher. Example - there was folder “company”, inside it was folder “clients” and inside “clients” were folders “client1” and “client2”. After syncing, “client1” and “client2” moved up and appeared in folder “company” instead of staying in folder “clients”. It happened twice, as we tried to sync it again via app after deleting previous sync from computer.
Is there any limits for folder’s size?
What can we do?

Is this the first time you’ve seen this error? : Yes

The output of your Nextcloud log in Admin > Logging:
I’ve just updated Nextcloud, so there’s nothing much except for info about “Succesful update”

\OC\Updater::updateEnd: Update successful

The output of your config.php file in /path/to/nextcloud:

<?php
$CONFIG = array (
  'trusted_domains' =>
  array (
    0 => 'localhost',
    1 => '192.168.12.55',
  ),
  'overwrite.cli.url' => 'https://clo*******u/',
  'htaccess.RewriteBase' => '/',
  'passwordsalt' => '******',
  'secret' => '******',
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '22.2.6.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => '******',
  'dbpassword' => '******',
  'installed' => true,
  'instanceid' => '******',
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
  'enable_previews' => false,
  'default_phone_region' => 'RU',
  'maintenance' => false,
  'log_type' => 'file',
  'logfile' => '/var/log/nextcloud/nextcloud.log',
  'log_rotate_size' => 20971520,
  'loglevel' => '2',
  'logtimezone' => 'Europe/Moscow',
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_sendmailmode' => 'smtp',
  'mail_from_address' => '******',
  'mail_domain' => '******',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_smtpauth' => 1,
  'mail_smtphost' => '******',
  'mail_smtpport' => '******',
  'mail_smtpname' => '******',
  'mail_smtppassword' => '******',
  'updater.secret' => '******',
  'theme' => '',
);

The output of your Apache/nginx/system log in /var/log/____:

[Fri Apr 01 10:34:43.701369 2022] [php7:error] [pid 74100] [client 192.168.12.12:49548] PHP Fatal error:  Uncaught PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:92\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php(92): PDOStatement->execute()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1163): Doctrine\\DBAL\\Driver\\PDO\\Statement->execute()\n#2 /var/www/nextcloud/lib/private/DB/Connection.php(267): Doctrine\\DBAL\\Connection->executeStatement()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(354): OC\\DB\\Connection->executeStatement()\n#4 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/www/nextcloud/lib/private/Lock/DBLockingProvider.php(310): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 [internal function]: OC\\Lock\\DBLockingProvider->releaseAll()\n#7 {main}\n\nNext Doctrine\\DBAL\\Driver\\PDO\\Exception: SQLSTATE[40001]: S in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php on line 37
[Fri Apr 01 10:38:00.342981 2022] [php7:error] [pid 75272] [client 192.168.12.12:49553] PHP Fatal error:  Uncaught PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:92\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php(92): PDOStatement->execute()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1163): Doctrine\\DBAL\\Driver\\PDO\\Statement->execute()\n#2 /var/www/nextcloud/lib/private/DB/Connection.php(267): Doctrine\\DBAL\\Connection->executeStatement()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(354): OC\\DB\\Connection->executeStatement()\n#4 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/www/nextcloud/lib/private/Lock/DBLockingProvider.php(310): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 [internal function]: OC\\Lock\\DBLockingProvider->releaseAll()\n#7 {main}\n\nNext Doctrine\\DBAL\\Driver\\PDO\\Exception: SQLSTATE[40001]: S in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php on line 37
[Fri Apr 01 10:38:06.358848 2022] [php7:error] [pid 75699] [client 192.168.12.12:49550] PHP Fatal error:  Uncaught PDOException: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php:92\nStack trace:\n#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/PDO/Statement.php(92): PDOStatement->execute()\n#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1163): Doctrine\\DBAL\\Driver\\PDO\\Statement->execute()\n#2 /var/www/nextcloud/lib/private/DB/Connection.php(267): Doctrine\\DBAL\\Connection->executeStatement()\n#3 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(354): OC\\DB\\Connection->executeStatement()\n#4 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(287): Doctrine\\DBAL\\Query\\QueryBuilder->execute()\n#5 /var/www/nextcloud/lib/private/Lock/DBLockingProvider.php(310): OC\\DB\\QueryBuilder\\QueryBuilder->execute()\n#6 [internal function]: OC\\Lock\\DBLockingProvider->releaseAll()\n#7 {main}\n\nNext Doctrine\\DBAL\\Driver\\PDO\\Exception: SQLSTATE[40001]: S in /var/www/nextcloud/3rdparty/doctrine/dbal/src/Driver/API/MySQL/ExceptionConverter.php on line 37

Sorry. I can not really help. But the above part of your logs can belong to an issue of previewgenerator. Do you use the app Preview Generator? If yes perhaps you can search this way. But maybe the logs do not belong to your problem. Also it is conceivable that the error belogs to another app or function.

If it is a caching problem (discussed in the above issue) you can read this and the part redis.

Hi!
I don’t use Preview Generator.
I installed APCu, now I don’t have this warning in “overview” - “Security & setup warnings”. Now syncing going faster. But still crashes :frowning:
I also have this problem during sync, where it says “metadata updating error: couldn’t set pin state”, don’t really know what is this. After this Nextcloud start to count files again, then start syscing again. And crashes again.