-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Fatal error: Uncaught PDOException: Deadlock detected #15047
Comments
I have a similar deadlock occurring (using nextcloud 16.0.3). It happens when uploading a file over webdav. Nginx returns a 423 http status code. At the postgres level a lot is happening; it basically starts with multiple:
and then deadlocks get detected, like this one:
As the client keeps reiterating it's http put request, after a short while the postgres server hits its maximum number of connections:
which is pretty ridiculous, provided this is a single nextcloud user setup (with a max of 200 connections on the postgres backend).
|
Likely I was seeing #11136. |
@mfr00t @jknockaert would you mind to edit your post and add the issue template? To reproduce such issues its required to setup a similar environment (webserver, active apps, configuration, etc.). A workaround for you could be to disable filelocking or use redis as locking provider.
server/lib/private/Lock/DBLockingProvider.php Lines 309 to 312 in f5c0ea8
The query looks related to the cleanup logs logic. This is tricky because the action / task is done and the final step is to delete our locks (on files in nextcloud) and run into a deadlock while trying to change the db values (because the db entry related to the file lock is locked by another process).
Could you try the above patch? I wonder if the unlocking would be more stable (but slower in situations with many locked files) when updating each lock for itself instead of changing multiple locks with one update. |
This issue has been automatically marked as stale because it has not had recent activity and seems to be missing some essential information. It will be closed if no further activity occurs. Thank you for your contributions. |
Hey @mfr00t 🏓 |
Got some deadlocks: OS: Debian Steps to reproduce on my server
[Thu Oct 03 16:05:52.717041 2019] [php7:error] [pid 1153] [client 172.16.3.1:55162] PHP Fatal error: Uncaught PDOException: SQLSTATE[40P01]: Deadlock detected: 7 ERROR: deadlock detected\nDETAIL: Process 1914 waits for ShareLock on transaction 36709; blocked by process 1913.\nProcess 1913 waits for ShareLock on transaction 36711; blocked by process 1914.\nHINT: See server log for query details.\nCONTEXT: while locking tuple (1,128) in relation "oc_file_locks" in /var/www/html/nc/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php:141\nStack trace:\n#0 /var/www/html/nc/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/PDOStatement.php(141): PDOStatement->execute(NULL)\n#1 /var/www/html/nc/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Connection.php(1079): Doctrine\DBAL\Driver\PDOStatement->execute()\n#2 /var/www/html/nc/lib/private/DB/Connection.php(216): Doctrine\DBAL\Connection->executeUpdate('UPDATE "oc_file...', Array, Array)\n#3 /var/www/html/nc/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryBuilder.php(222): OC\DB\Connection->executeUpdate('UPDATE "oc_file...', Array, Array)\n#4 /var/www/html/nc/li in /var/www/html/nc/3rdparty/doctrine/dbal/lib/Doctrine/DBAL/Driver/AbstractPostgreSQLDriver.php on line 55 The number of deadlocks varies from time to time, but some are there. |
I am having the same issue on a 16.0.6 instance running with official docker image and PostgreSQL and Redis for file locking. Here is the template for my case: Steps to reproduce
Expected behaviourUpload of files should work fine. Actual behaviourSome files are not uploaded and we need to retry the synchro Server configurationOperating system: Official docker image (alpine) Web server: Nginx Database: PostgreSQL PHP version: official docker image (alpine) Nextcloud version: 16.0.6 Updated from an older Nextcloud/ownCloud or fresh install: updated from previous docker images Where did you install Nextcloud from: docker image Signing status: Signing status
List of activated apps: App list
Nextcloud configuration: Config report
Are you using external storage, if yes which one: Openstack (but not involved in the scenario) Are you using encryption: yes (only for external storage) Are you using an external user-backend, if yes which one: No Client configurationBrowser: Linux Nextcloud client Operating system: Ubuntu LogsNextcloud client logNextcloud client log
Web server error logWeb server error log
Nextcloud log (data/nextcloud.log)Nextcloud log
Browser logBrowser log
|
+1 here ... same error on a fresh install of Nextcloud 18 on FreeBSD 12.1, php 7.3.16 and PostgreSQL 12 + memcache and redis, one user. Hardware of the Server: 4-core Xeon with 32GB RAM and 2x2TB enterprise-hdd. Tried to sync 5GB (3900 pictures) and got loads of deadlocks. |
+1, tons of:
this is with 18.0.3 on FreeBSD 12.1 / PostgreSQL 11.6 |
This comment has been minimized.
This comment has been minimized.
Since upgrade from 19.0.1 to 19.0.2 today, i'm having this problem too, each time i delete some files in a folder. Filelocking is enabled on Redis. I'm using MariaBD 10.4.
|
Same issue for me right after upgrading to 19.0.2, happens with all installations - #22482 (comment) |
I have it even with deactivated locking... Very annoying. |
Same issue when uploading multiple files. Ubuntu Server 20.04 LTS. Galera cluster with read-committed mode. PHP 7.4 |
Same issue. Freebsd 12.2-RELEASE-p2, PostgreSQL 12.4, Nextcloud 20.0.4, APCu memory caching. |
Is this Issue still valid in NC21.0.3? If not, please close this issue. Thanks! :) |
Server configuration
OS: Debian 9
Nextcloud Version: 15(0.7)
PHP Version: 7.2 (fpm)
Database: Postgresql 9.6
Webserver: Apache
Single-User system
Steps to reproduce
not known
fpm and postgres logs getting spammed with these entries:
Logs
fpm_nextcloud.log:
postgresql-9.6-main.log:
The text was updated successfully, but these errors were encountered: