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

duplicate key value violates unique constraint "remote_media_cache_media_origin_media_id_key" when getting remote thumbnails #6755

@michaelkaye

Description

@michaelkaye

on matrix-org-hotfixes:

psycopg2.errors.UniqueViolation: duplicate key value violates unique constraint "remote_media_cache_media_origin_media_id_key"
DETAIL:  Key (media_origin, media_id)=(XXX.net, XXXXXXXXXXXXscjwZ) already exists.

This fires when attempting to get a thumbnail for some remote media:

GET /_matrix/media/r0/thumbnail/XXX.net/XXXXXXXXXXXXscjwZ?width=30&height=30&method=crop

There were multiple requests to this URL from different IPs near-simultaneously - presumably someone just posted this to a large channel.

The request to the remote server to download the media looks just fine, I assume there's a race somewhere. If this duplicate error is OK can we suppress the logging of it, as it's a ~200line stacktrace, but ideally the additional connections block and don't process the upload.

Metadata

Metadata

Assignees

Labels

z-bug(Deprecated Label)z-p2(Deprecated Label)

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions