Corrupt DB-Tables?

Hi,

i’m facing a DB Problem on 2 different Nextcloud Instances.

My Nextcloud is running but after a few weeks my OC_file_locks and my OC_filecache Table are corrupted. Nextcloud is running in a VM on Ubuntu 18.04 an MariaDB 10.4.12.

I am using Nextcloud only for SMB Shares on a Windows Server.

When accessing my shared links i get an Internal Server error. But i can access all folders if i log in to nextcloud. The mysql --autorepair option get stuck at the oc_file_locks table.

Reboot of the VM is not possible because it is waiting for the MariaDB to shutdown. So i have to reset the VM. But after a reboot i get the same error.
So i Truncated the OC_file_locks and now the auto-repair gets stuck at the oc_filecache. So i Truncated this table too.
Now all my shared links are gone, but i can create new ones and access these links perfectly…

But after 2 weeks i get the same error again.

So i set up a new nextcloud VM 2 weeks ago. But now i am facing all the same errors again. This time i haven’t configured the filecache and disabled the oc_file_locks in the config.php file with “‘filelocking.enabled’ => false”, but both tables are filling up until they don’t work anymore…

Do you have any idea how i can fix this error?

[/details]

Nextcloud version (eg, 12.0.2): 18.0.3
Operating system and version (eg, Ubuntu 17.04): Ubuntu 18.04.4 LTS
Apache or nginx version (eg, Apache 2.4.25): Apache/2.4.29
PHP version (eg, 7.1): PHP 7.2.24-0ubuntu0.18.04.3

The output of your Nextcloud log in Admin > Logging:

Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586849076]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:25:27+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [25, "backgroundjob", "lastjob", 25]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:20:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [24, "backgroundjob", "lastjob", 24]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:15:52+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586848383]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:13:54+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [23, "backgroundjob", "lastjob", 23]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:10:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [22, "backgroundjob", "lastjob", 22]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:05:52+0200
Error	files	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/4501797903fcb0a60ec5668e00a70e11", -1, 1586847822]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:04:33+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [20, "backgroundjob", "lastjob", 20]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:00:52+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586847596]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T08:00:47+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [19, "backgroundjob", "lastjob", 19]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:55:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [17, "backgroundjob", "lastjob", 17]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:50:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [15, "backgroundjob", "lastjob", 15]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:45:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [5, "backgroundjob", "lastjob", 5]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:40:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [1, "backgroundjob", "lastjob", 1]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:35:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [14, "backgroundjob", "lastjob", 14]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:30:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [13, "backgroundjob", "lastjob", 13]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:25:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [12, "backgroundjob", "lastjob", 12]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:20:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [11, "backgroundjob", "lastjob", 11]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:15:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [18, "backgroundjob", "lastjob", 18]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:14:23+0200
Error	core	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'DELETE FROM `oc_file_locks` WHERE `ttl` < ?' with params [1586840101]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:13:32+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [10, "backgroundjob", "lastjob", 10]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:10:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [9, "backgroundjob", "lastjob", 9]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:05:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [4, "backgroundjob", "lastjob", 4]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T07:00:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [41, "backgroundjob", "lastjob", 41]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:50:58+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [40, "backgroundjob", "lastjob", 40]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:45:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [39, "backgroundjob", "lastjob", 39]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:40:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [33, "backgroundjob", "lastjob", 33]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:35:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [6, "backgroundjob", "lastjob", 6]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:30:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [3, "backgroundjob", "lastjob", 3]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:25:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [2, "backgroundjob", "lastjob", 2]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:24:26+0200
Error	core	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'DELETE FROM `oc_share` WHERE `item_type` in ('file', 'folder') AND NOT EXISTS (SELECT `fileid` FROM `oc_filecache` WHERE `file_source` = `fileid`)': SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:20:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [28, "backgroundjob", "lastjob", 28]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:15:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [25, "backgroundjob", "lastjob", 25]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:10:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [24, "backgroundjob", "lastjob", 24]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:05:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [23, "backgroundjob", "lastjob", 23]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T06:00:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [22, "backgroundjob", "lastjob", 22]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:55:53+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839841]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:51:32+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839839]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:51:30+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839827]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:51:18+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839821]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:51:12+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839814]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:51:05+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839810]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:51:01+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [20, "backgroundjob", "lastjob", 20]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:50:53+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839765]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:50:16+0200
Error	index	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/30fb6c9d94d882fb67adb4bf2c8a3f3d", -1, 1586839759]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:50:10+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [19, "backgroundjob", "lastjob", 19]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:45:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [17, "backgroundjob", "lastjob", 17]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:40:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [15, "backgroundjob", "lastjob", 15]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:35:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [5, "backgroundjob", "lastjob", 5]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:30:53+0200
Error	files	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/b87f1b4d7e48783c130aaafe9a7ee27e", -1, 1586838576]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:30:27+0200
Error	files	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/a9e2b4db72eb8d838bfc68e1cdb0367d", -1, 1586838522]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:29:33+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [1, "backgroundjob", "lastjob", 1]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:25:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [14, "backgroundjob", "lastjob", 14]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:20:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [13, "backgroundjob", "lastjob", 13]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:15:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [12, "backgroundjob", "lastjob", 12]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:10:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [18, "backgroundjob", "lastjob", 18]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:07:16+0200
Error	core	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'DELETE FROM `oc_file_locks` WHERE `ttl` < ?' with params [1586832301]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:06:25+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [11, "backgroundjob", "lastjob", 11]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:05:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [10, "backgroundjob", "lastjob", 10]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T05:00:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [9, "backgroundjob", "lastjob", 9]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:55:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [4, "backgroundjob", "lastjob", 4]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:50:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [41, "backgroundjob", "lastjob", 41]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:40:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [40, "backgroundjob", "lastjob", 40]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:35:53+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [39, "backgroundjob", "lastjob", 39]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:30:52+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_jobs` SET `reserved_at` = '0' WHERE `id` = ?' with params [16]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:25:57+0200
Error	cron	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_appconfig` SET `configvalue` = ? WHERE (`appid` = ?) AND (`configkey` = ?) AND (`configvalue` <> ?)' with params [33, "backgroundjob", "lastjob", 33]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:25:52+0200
Error	core	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_jobs` SET `execution_duration` = ? WHERE `id` = ?' with params [11053, 16]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:25:06+0200
Error	files	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/3d28aa813326448336004398ab1eff9d", -1, 1586834604]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:24:15+0200
Error	files	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/52724caeaee8db7b8896e732c7e3ab2e", -1, 1586834553]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:23:24+0200
Error	files	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/f41155578e41d8aa3867f83473f31505", -1, 1586834502]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:22:33+0200
Error	files	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'INSERT INTO `oc_file_locks` (`key`, `lock`, `ttl`) VALUES(?, ?, ?)' with params ["files\/54ae049377141294affef6d727999e1d", -1, 1586834451]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-14T04:21:42+0200

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

<?php
$CONFIG = array (
  'instanceid' => 'yyy',
  'passwordsalt' => 'xxx',
  'secret' => 'yyy',
  'trusted_domains' =>
  array (
    0 => '172.x.x.x',
    1 => 'xxx',
  ),
  'datadirectory' => '/var/www/nextcloud/data',
  'dbtype' => 'mysql',
  'version' => '18.0.3.0',
  'overwrite.cli.url' => 'xxx',
  'htaccess.RewriteBase' => '/',
  'dbname' => 'nextcloud',
  'dbhost' => 'localhost',
  'dbport' => '',
  'dbtableprefix' => 'oc_',
  'dbuser' => 'nextclouduser',
  'dbpassword' => 'xxx',
  'installed' => true,
  'maintenance' => false,
  'filelocking.enabled' => false,
  'mysql.utf8mb4' => true,
  'theme' => '',
  'loglevel' => 2,
  'mail_from_address' => 'cloud',
  'mail_smtpmode' => 'smtp',
  'mail_sendmailmode' => 'smtp',
  'mail_domain' => 'xxx',
  'mail_smtphost' => 'xxx',
  'mail_smtpport' => '25',
  'ldapIgnoreNamingRules' => false,
  'ldapProviderFactory' => 'OCA\\User_LDAP\\LDAPProviderFactory',
);

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

[Tue Apr 14 06:25:03.264967 2020] [mpm_prefork:notice] [pid 1403] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Tue Apr 14 06:25:03.265000 2020] [core:notice] [pid 1403] AH00094: Command line: '/usr/sbin/apache2'
[Tue Apr 14 07:03:36.669168 2020] [core:notice] [pid 1403] AH00051: child pid 17501 exit signal Segmentation fault (11), possible coredump in /etc/apache2
[Tue Apr 14 07:03:36.738481 2020] [mpm_prefork:notice] [pid 1403] AH00169: caught SIGTERM, shutting down
[Tue Apr 14 07:05:50.848862 2020] [mpm_prefork:notice] [pid 1402] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Tue Apr 14 07:05:50.849313 2020] [core:notice] [pid 1402] AH00094: Command line: '/usr/sbin/apache2'
[Tue Apr 14 07:27:16.503880 2020] [mpm_prefork:notice] [pid 1402] AH00169: caught SIGTERM, shutting down
[Tue Apr 14 07:32:43.380018 2020] [mpm_prefork:notice] [pid 1355] AH00163: Apache/2.4.29 (Ubuntu) OpenSSL/1.1.1 configured -- resuming normal operations
[Tue Apr 14 07:32:43.391434 2020] [core:notice] [pid 1355] AH00094: Command line: '/usr/sbin/apache2'
[Tue Apr 14 08:24:37.286061 2020] [access_compat:error] [pid 3852] [client 31.16.252.215:9860] AH01797: client denied by server configuration: /var/www/nextcloud/config

I get a lot of these errors, the past few days. There are a few access errors again, which where fine a few days ago…

Fatal	webdav	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_filecache` SET `mtime` = ?, `etag` = ?, `storage_mtime` = ?, `checksum` = ? WHERE (`fileid` = ?) AND (((`mtime` <> ?) OR (`mtime` IS NULL)) OR ((`etag` <> ?) OR (`etag` IS NULL)) OR ((`storage_mtime` <> ?) OR (`storage_mtime` IS NULL)) OR ((`checksum` <> ?) OR (`checksum` IS NULL)))' with params [1587453213, "5e9ea0e192cb8", 1587453213, "", 3769, 1587453213, "5e9ea0e192cb8", 1587453213, ""]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-21T09:30:28+0200
Error	no app in context	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_filecache` SET `mtime` = ?, `etag` = ?, `storage_mtime` = ?, `checksum` = ? WHERE (`fileid` = ?) AND (((`mtime` <> ?) OR (`mtime` IS NULL)) OR ((`etag` <> ?) OR (`etag` IS NULL)) OR ((`storage_mtime` <> ?) OR (`storage_mtime` IS NULL)) OR ((`checksum` <> ?) OR (`checksum` IS NULL)))' with params [1587453213, "5e9ea0e1de69a", 1587453213, "", 3769, 1587453213, "5e9ea0e1de69a", 1587453213, ""]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction	
2020-04-21T09:30:28+0200
Fatal	webdav	Doctrine\DBAL\Exception\LockWaitTimeoutException: An exception occurred while executing 'UPDATE `oc_filecache` SET `mtime` = ?, `etag` = ?, `storage_mtime` = ?, `checksum` = ? WHERE (`fileid` = ?) AND (((`mtime` <> ?) OR (`mtime` IS NULL)) OR ((`etag` <> ?) OR (`etag` IS NULL)) OR ((`storage_mtime` <> ?) OR (`storage_mtime` IS NULL)) OR ((`checksum` <> ?) OR (`checksum` IS NULL)))' with params [1587450048, "5e9e9152a7e92", 1587450048, "", 3769, 1587450048, "5e9e9152a7e92", 1587450048, ""]: SQLSTATE[HY000]: General error: 1205 Lock wait timeout exceeded; try restarting transaction

My oc_file_locks table has 0 rows (because i disabled file locking)
and my oc_filecache has generated 38.224.933 rows in about 2 weeks. Seems a bit to much.

So all my problems seem to be related to the locked Database. Do you have any ideas how i can solve this?

I think you’ve figured out that the error is about database transaction locking not file locking.

You can increase the lock timeout setting in MariaDb ( innodb_lock_wait_timeout) but another question is why is the oc_filecache table growing so quickly and is it a problem to worry about?

Well maybe It depends on your requirements as well as system resources. The external storage app keeps file versions just like normal Nextcloud files and these have entries in oc_filecache. You can change aging parameters depending on your needs for keeping these versions on Nextcloud - https://docs.nextcloud.com/server/latest/admin_manual/configuration_files/file_versioning.html. Alternatively you can clean up versions with php occ commands on a recurring basis but make sure this is something you want to do.

Might be worth taking a look at recent entries in oc_filecache to get your head around what you might want to change.

Hi Joshmorel,

thanks for you answer. I already increased the “innodb_lock_wait_timeout” from 50 (standard) to 180.

If there were no problems, i wouldn’t mind that the filecache is growing up so fast. There are enough system ressources available. But the table generates these lock timeouts, so the nextcloud instance does not work properly.

I will check the File Versioning. I don’t think i need this feature. I will try to decrease it to one day.

Do the file-locking with redis, it is much faster and reduces the load on your database server.

Such things do not look good. Keep an eye on your system, are you running out of RAM?