-
-
Notifications
You must be signed in to change notification settings - Fork 4.1k
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
Resolve ERROR: duplicate key value violates unique constraint "oc_credentials_pkey" #12204
Comments
GitMate.io thinks possibly related issues are #6343 (PostgreSQL : duplicate key value violates unique constraint error message), #4728 (Postgres duplicate key violation causes Internal Server Error during sync), #11779 (SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry * for key 'lock_key_index'), #1779 (Webdav Calendar Integrity constraint violation: 1062 Duplicate entry), and #9305 (Race condition with locks in database - unique constraint violation on oc_file_locks). |
Same here, Nextcloud 14.0.3, PHP 7.2.10, PostgreSQL 11.0, Redis, no LDAP Auth. |
Is there any way to fix this? Running two instances of latest Nextcloud with a PGSQL back-end and only one of them exhibits this issue. It seems like some manual interaction can resolve the never-ending log spam. |
This issue has been automatically marked as stale because it has not had recent activity and it seems to be missing some essential informations. It will be closed if no further activity occurs. Thank you for your contributions. |
It looks like this issue is being ignored? Only a bot got interested 🤔 |
Hey, just wanted to share a small experience I've had with this issue: Thanks to Netdata, one day, all of sudden I got notifications from it saying my VPS is in a high CPU usage state for more than 5 minutes. I logged into it, ran |
Still happening every 500ms for me on the latest Nextcloud 16.0.4, it's generated almost 2gb of these repeated log messages at this point:
I added |
There is some progress on this kind of issues but it's a tricky one. What is logged into your logs as "error" is actually intended. We try to insert a record, a exception is emitted because the unique constraint is violated, we catch this exception and update the record instead. If you do a select (is there a record with this data) first there is always a (very small) chance that in the time between the select and the insert another process creates the record and we run into the same issue. General support for upsert has been added with this pr: #13721 What's left is to migrate places (like this one) to the new code. From the code path i guess the default case here is update. I'm not sure why nextcloud tries to insert the credentials so often but this should be investigated first. A doctrine developer (doctrine is the database abstraction layer used by nextcloud) stated about upsert support in doctrine:
I think we are in such a key-value case here with the credentials stuff. |
My postgresql log gets filled with this error too. If you need any further debug logs please tell me.
|
I got the same error after migration to a new server (but the domain name remained). |
I don't think it is acceptable to let postgres throw errors in normal operation. If a realy error happens I probably don't see it except if I do log filtering. |
Closing this one as duplicate of #6343. There is also a possible patch over there for you to test.
Yes! I wonder why no one earlier reported that to the postgres people. Logging a error for a unique constraint violation seems strange. At least from a application developer view with cross database compatibility in mind. Probably it makes sense for a database engineer. They are reporting the violation correctly back to doctrine/dbal (so nextcloud is able to handle it) but also log an error. |
currently facing the same problem in nextcloud 17 and providing us the same probelm |
As mentioned by @HKMglicks, please reopen, it keeps appearing at Nextcloud 18
|
please reopen, it keeps appearing at Nextcloud 19 |
Getting a lot of these in the logs of a few instances. All of which are
linuxserver/nextcloud
andlibrary/postgres
based, running latest releases of their Docker images and latest stable Nextcloud. How should this be resolved?The text was updated successfully, but these errors were encountered: