Database Deadlocks when uploading many files via Webinterface

Support intro

Sorry to hear you’re facing problems :slightly_frowning_face:

help.nextcloud.com is for home/non-enterprise users. If you’re running a business, paid support can be accessed via portal.nextcloud.com where we can ensure your business keeps running smoothly.

In order to help you as quickly as possible, before clicking Create Topic please provide as much of the below as you can. Feel free to use a pastebin service for logs, otherwise either indent short log examples with four spaces:

example

Or for longer, use three backticks above and below the code snippet:

longer
example
here

Some or all of the below information will be requested if it isn’t supplied; for fastest response please provide as much as you can :heart:

Nextcloud version (eg, 20.0.5): 25.0.3
Operating system and version (eg, Ubuntu 20.04): RaspberryPi OS
Apache or nginx version (eg, Apache 2.4.25): Apache 2
PHP version (eg, 7.4): 8.1

The issue you are facing:
When uploading multiple files via webinterface i see several DB Deadlocks. it seems like nothing is missing thou, so most liekly it works by repeating the transaction as the error message says.

Is this the first time you’ve seen this error? (Y/N): No

Steps to replicate it:

  1. Upload like 50 files in several folders by D&D into the webinterface
  2. wait and see error messages pop up

The output of your Nextcloud log in Admin > Logging:

[webdav] Error: Doctrine\DBAL\Exception\DeadlockException: An exception occurred while executing a query: SQLSTATE[40001]: Serialization failure: 1213 Deadlock found when trying to get lock; try restarting transaction at <<closure>>

 0. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1780
    Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert()
 1. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1719
    Doctrine\DBAL\Connection->handleDriverException()
 2. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php line 1173
    Doctrine\DBAL\Connection->convertExceptionDuringQuery()
 3. /var/www/nextcloud/lib/private/DB/Connection.php line 294
    Doctrine\DBAL\Connection->executeStatement()
 4. /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php line 354
    OC\DB\Connection->executeStatement()
 5. /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php line 281
    Doctrine\DBAL\Query\QueryBuilder->execute()
 6. /var/www/nextcloud/lib/private/Files/Cache/Cache.php line 382
    OC\DB\QueryBuilder\QueryBuilder->execute()
 7. /var/www/nextcloud/lib/private/Files/Cache/Wrapper/CacheWrapper.php line 145
    OC\Files\Cache\Cache->update("*** sensitive parameters replaced ***")
 8. /var/www/nextcloud/lib/private/Files/Cache/Updater.php line 256
    OC\Files\Cache\Wrapper\CacheWrapper->update("*** sensitive parameters replaced ***")
 9. /var/www/nextcloud/lib/private/Files/Cache/Updater.php line 138
    OC\Files\Cache\Updater->correctParentStorageMtime()
10. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/File.php line 368
    OC\Files\Cache\Updater->update("*** sensitive parameters replaced ***")
11. /var/www/nextcloud/apps/dav/lib/Connector/Sabre/Directory.php line 151
    OCA\DAV\Connector\Sabre\File->put()
12. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 1098
    OCA\DAV\Connector\Sabre\Directory->createFile()
13. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/CorePlugin.php line 504
    Sabre\DAV\Server->createFile()
14. /var/www/nextcloud/3rdparty/sabre/event/lib/WildcardEmitterTrait.php line 89
    Sabre\DAV\CorePlugin->httpPut()
15. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 472
    Sabre\DAV\Server->emit()
16. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 253
    Sabre\DAV\Server->invokeMethod()
17. /var/www/nextcloud/3rdparty/sabre/dav/lib/DAV/Server.php line 321
    Sabre\DAV\Server->start()
18. /var/www/nextcloud/apps/dav/appinfo/v1/webdav.php line 85
    Sabre\DAV\Server->exec()
19. /var/www/nextcloud/remote.php line 171
    require_once("/var/www/nextcl ... p")

PUT /remote.php/webdav/... (path and filename removed)
from 10.0.0.31 by  Username at 2023-03-22T19:16:14+00:00

The output of your config.php file in /path/to/nextcloud (make sure you remove any identifiable information!):

<?php
$CONFIG = array (
  'passwordsalt' => 'removed',
  'secret' => 'removed',
  'trusted_domains' =>
  array (
    0 => 'localhost',
    5 => 'nextcloudpi.local',
    1 => '10.0.0.4',
    2 => 'removed',
    7 => 'nextcloudpi',
    8 => 'nextcloudpi.lan',
    11 => '178.115.240.173',
    4 => 'removed',
    12 => 'removed',
    20 => '10.0.0.1',
    3 => 'nextcloudpi',
    22 => 'removed',
    14 => 'nextcloudpi',
    '' => 'removed,
  ),
  'datadirectory' => '/media/myCloudDrive/ncdata',
  'tempdirectory' => '/media/myCloudDrive/ncdata/tmp',
  'overwrite.cli.url' => 'https://nextcloudpi/',
  'dbtype' => 'mysql',
  'version' => '25.0.3.2',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'mysql.utf8mb4' => true,
  'dbuser' => 'ncadmin',
  'dbpassword' => 'removed',
  'installed' => true,
  'instanceid' => 'removed',
  'memcache.local' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' =>
  array (
    'host' => '/var/run/redis/redis.sock',
    'port' => 0,
    'timeout' => 0.0,
    'password' => 'removed',
  ),
  'appstoreenabled' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpauthtype' => 'LOGIN',
  'mail_from_address' => 'removed',
  'mail_domain' => 'removed',
  'overwriteprotocol' => 'https',
  'maintenance' => false,
  'logfile' => '/media/myCloudDrive/ncdata/nextcloud.log',
  'loglevel' => '2',
  'log_type' => 'file',
  'theme' => '',
  'updater.release.channel' => 'stable',
  'htaccess.RewriteBase' => '/',
  'jpeg_quality' => '60',
  'data-fingerprint' => 'removed',
  'default_locale' => 'de_AT',
  'default_phone_region' => 'AT',
  'app_install_overwrite' =>
  array (
    0 => 'apporder',
    1 => 'impersonate',
    2 => 'defaultlinkopen',
    3 => 'initialcheck',
    4 => 'occweb',
    5 => 'files_texteditor',
    6 => 'dashboard',
    7 => 'radio',
    8 => 'files_external_onedrive',
    9 => 'social',
    10 => 'printer',
    11 => 'admin_notifications',
    12 => 'previewgenerator',
    13 => 'weather',
    14 => 'files_trackdownloads',
    15 => 'folderplayer',
    16 => 'keeporsweep',
  ),
  'mail_sendmailmode' => 'smtp',
  'mail_smtpsecure' => 'tls',
  'mail_smtpauth' => 1,
  'mail_smtphost' => 'removed',
  'mail_smtpport' => '587',
  'mail_smtpname' => 'removed',
  'mail_smtppassword' => 'removed',
  'trusted_proxies' =>
  array (
    11 => '127.0.0.1',
    12 => '::1',
    13 => 'nextcloudpi',
    14 => '',
  ),
);

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

PASTE HERE

PASTE HERE


Output errors in nextcloud.log in /var/www/ or as admin user in top right menu, filtering for errors. Use a pastebin service if necessary.


no real help but this bug reports sound very similar (follow the references as well :wink: )