element-hq / element-hq/synapse

Occasional UniqueViolation in device_lists_remote_cache_unique_id

Open
#16,243 0 comments 0 reactions 0 assignees View on GitHub
A-Database A-Device-List-Tracking S-Minor T-Defect
Dominant language
Python
Stars
4.6k
Forks
600
Avg merge
5d 22h
Merged PRs (30d)
51

Description

This issue has been migrated from [#16243](https://github.com/matrix-org/synapse/issues/16243).

---

e.g.

- https://sentry.tools.element.io/organizations/element/issues/71346/
- https://sentry.tools.element.io/organizations/element/issues/78907/
- https://sentry.tools.element.io/organizations/element/issues/84351/

From looking at the source, the only insert that isn't an upsert I can see is

https://github.com/matrix-org/synapse/blob/69048f7b4848ab6a4ae6cb233f8cbf36d73c0ba1/synapse/storage/databases/main/devices.py#L1911-L1919

which might emit this error if

- the same (user, device) ID appears twice in this batch of queries, or
- this (user, device) pair already exists in the DB.

Tracebacks in Sentry seems to corroborate my suspicions --- they have the quoted function in their stack.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.