Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Lots of psql duplicate key errors for device_uniqueness and users_name_key #5961

Open
richvdh opened this issue Sep 2, 2019 · 4 comments
Open
Labels
A-Logging Synapse's logs (structured or otherwise). Not metrics. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. z-p2 (Deprecated Label)

Comments

@richvdh
Copy link
Member

richvdh commented Sep 2, 2019

We get thousands of these a day:

2019-09-02 00:00:03.009 UTC [matrix main] ERROR:  duplicate key value violates unique constraint "device_uniqueness"
2019-09-02 00:00:04.622 UTC [matrix main] ERROR:  duplicate key value violates unique constraint "users_name_key"

They are due (I think) to our poor man's upsert impl, which we should replace with a proper upsert.

@richvdh richvdh added A-Logging Synapse's logs (structured or otherwise). Not metrics. z-p2 (Deprecated Label) labels Sep 2, 2019
@Valodim
Copy link
Contributor

Valodim commented Sep 2, 2019

Just a heads up for folks who find this issue because they are facing weird unique constraint violation errors: I've had similar errors after an upgrade to debian buster, due to https://postgresql.verite.pro/blog/2018/08/27/glibc-upgrade.html. This happens when you don't correctly set the collation of all tables to "C" as requested in the documentation.

@Ezwen
Copy link

Ezwen commented Oct 4, 2019

We have this problem (only with device_uniqueness) on our homeserver but we did not update to debian buster, any idea? Should we be worried?

@richvdh
Copy link
Member Author

richvdh commented Oct 7, 2019

Should we be worried?

No. The errors are annoying but not otherwise a problem.

@MurzNN
Copy link

MurzNN commented Jul 21, 2021

See in logs same errors when configuring application services:

2021-07-21 18:15:53.321 MSK [2739047] matrix_synapse@matrix_synapse ERROR:  duplicate key value violates unique constraint "users_name_key"
2021-07-21 18:15:53.321 MSK [2739047] matrix_synapse@matrix_synapse DETAIL:  Key (name)=(@facebook:homeserver.org) already exists.
2021-07-21 18:15:53.321 MSK [2739047] matrix_synapse@matrix_synapse STATEMENT:  INSERT INTO users (name, password_hash, creation_ts, is_guest, appservice_id, admin, user_type, shadow_banned) V
ALUES('@facebook:homeserver.org', '', 1626880553, 0, 'mautrix_facebook', 0, NULL, false)

@erikjohnston erikjohnston added the T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. label Jul 26, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Logging Synapse's logs (structured or otherwise). Not metrics. T-Task Refactoring, removal, replacement, enabling or disabling functionality, other engineering tasks. z-p2 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

5 participants