SQLSTATE[HY000] General error: 1205 Lock wait timeout when doing occ files:scan-app-data

Nextcloud version (eg, 20.0.5): 28.0.1
Operating system and version (eg, Ubuntu 20.04): Ubuntu 20.04 LTS
Apache or nginx version (eg, Apache 2.4.25): 2.4.52
PHP version (eg, 7.4): 8.1

I have used the image previewgenerator app. The preview files took about 800 GB of my SSD, that’s multiple times more than the filesize of my original pictures. So I deleted all files in the “preview” folder.

Next I need to execute occ files:scan-app-data but it always ran into an timeout error:

wolf@frida:/var/www/nextcloud$ sudo -u www-data php occ files:scan-app-data
Scanning AppData for files

Exception during scan: An exception occurred while executing a query: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction
#0 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1938): Doctrine\DBAL\Driver\API\MySQL\ExceptionConverter->convert()
#1 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1880): Doctrine\DBAL\Connection->handleDriverException()
#2 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Connection.php(1208): Doctrine\DBAL\Connection->convertExceptionDuringQuery()
#3 /var/www/nextcloud/lib/private/DB/Connection.php(294): Doctrine\DBAL\Connection->executeStatement()
#4 /var/www/nextcloud/3rdparty/doctrine/dbal/src/Query/QueryBuilder.php(386): OC\DB\Connection->executeStatement()
#5 /var/www/nextcloud/lib/private/DB/QueryBuilder/QueryBuilder.php(280): Doctrine\DBAL\Query\QueryBuilder->execute()
#6 /var/www/nextcloud/lib/private/Files/Cache/Cache.php(393): OC\DB\QueryBuilder\QueryBuilder->execute()
#7 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(414): OC\Files\Cache\Cache->update()
#8 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(400): OC\Files\Cache\Scanner->scanChildren()
#9 /var/www/nextcloud/lib/private/Files/Cache/Scanner.php(347): OC\Files\Cache\Scanner->scanChildren()
#10 /var/www/nextcloud/lib/private/Files/Cache/LocalRootScanner.php(39): OC\Files\Cache\Scanner->scan()
#11 /var/www/nextcloud/lib/private/Files/Utils/Scanner.php(273): OC\Files\Cache\LocalRootScanner->scan()
#12 /var/www/nextcloud/apps/files/lib/Command/ScanAppData.php(121): OC\Files\Utils\Scanner->scan()
#13 /var/www/nextcloud/apps/files/lib/Command/ScanAppData.php(156): OCA\Files\Command\ScanAppData->scanFiles()
#14 /var/www/nextcloud/3rdparty/symfony/console/Command/Command.php(298): OCA\Files\Command\ScanAppData->execute()
#15 /var/www/nextcloud/core/Command/Base.php(177): Symfony\Component\Console\Command\Command->run()
#16 /var/www/nextcloud/3rdparty/symfony/console/Application.php(1040): OC\Core\Command\Base->run()
#17 /var/www/nextcloud/3rdparty/symfony/console/Application.php(301): Symfony\Component\Console\Application->doRunCommand()
#18 /var/www/nextcloud/3rdparty/symfony/console/Application.php(171): Symfony\Component\Console\Application->doRun()
#19 /var/www/nextcloud/lib/private/Console/Application.php(206): Symfony\Component\Console\Application->run()
#20 /var/www/nextcloud/console.php(100): OC\Console\Application->run()
#21 /var/www/nextcloud/occ(11): require_once('...')
#22 {main}

The output of your config.php file

cat config/config.php
<?php
$CONFIG = array (
  'instanceid' => '1234567890',
  'passwordsalt' => '1234567890',
  'secret' => '1234567890',
  'trusted_domains' => 
  array (
    0 => 'cloud.domain.com',
    1 => '192.168.101.101',
  ),
  'datadirectory' => '/home/wolf/hd_cloud/nextcloud',
  'overwrite.cli.url' => 'https://cloud.domain.com',
  'dbtype' => 'mysql',
  'version' => '28.0.1.1',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextcloud',
  'dbpassword' => '1234567890',
  'default_phone_region' => 'DE',
  'default_language' => 'de',
  'default_locale' => 'de_DE',
  'installed' => true,
  'mail_smtpmode' => 'smtp',
  'mail_smtpsecure' => 'ssl',
  'mail_smtphost' => 'cloud.domain.com',
  'mail_smtpport' => '465',
  'mail_domain' => 'domain.com',
  'mail_from_address' => 'cloud',
  'mail_smtpauth' => 1,
  'mail_smtpname' => 'testing@domain.com',
  'mail_smtppassword' => '1234567890',
  'mail_smtpauthtype' => 'LOGIN',
  'filelocking.enabled' => true,
  'memcache.local' => '\\OC\\Memcache\\APCu',
  'memcache.distributed' => '\\OC\\Memcache\\Redis',
  'memcache.locking' => '\\OC\\Memcache\\Redis',
  'redis' => 
  array (
    'host' => '/run/redis/redis.sock',
    'port' => 0,
    'password' => '1234567890',
    'timeout' => 1.5,
  ),
  'maintenance' => false,
  'htaccess.RewriteBase' => '/',
  'loglevel' => 2,
  'loglevel_frontend' => 2,
  'logtimezone' => 'UTC',
  'theme' => '',
  'enable_previews' => true,
  'preview_max_y' => 512,
  'preview_max_x' => 512,
  'enabledPreviewProviders' => 
  array (
    0 => 'OC\\Preview\\TXT',
    1 => 'OC\\Preview\\MarkDown',
    2 => 'OC\\Preview\\OpenDocument',
    3 => 'OC\\Preview\\AVI',
    4 => 'OC\\Preview\\MSOffice2003',
    5 => 'OC\\Preview\\MSOfficeDoc',
    6 => 'OC\\Preview\\Image',
    7 => 'OC\\Preview\\Photoshop',
    8 => 'OC\\Preview\\TIFF',
    9 => 'OC\\Preview\\SVG',
    10 => 'OC\\Preview\\Font',
    11 => 'OC\\Preview\\MP3',
    12 => 'OC\\Preview\\Movie',
    13 => 'OC\\Preview\\MKV',
    14 => 'OC\\Preview\\MP4',
  ),
  'app_install_overwrite' => 
  array (
    0 => 'contacts',
    1 => 'admin_notifications',
    2 => 'dashboard',
    3 => 'calendar',
    4 => 'files_trackdownloads',
    5 => 'workflow_pdf_converter',
    6 => 'pdfannotate',
    7 => 'extract',
  ),
  'mysql.utf8mb4' => true,
  'data-fingerprint' => '1234567890',
);

I already set innodb_lock_wait_timeout=500 in /etc/mysql/my.cnf but I do not know if this is the right config file. But there is no effect, so nothing changed.

Anybody a hint how to go on? With that error message I couldn’t find any similiar in the forum.

1 Like