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

500 errors with "duplicate key value" on local_media_repository_thumbn_media_id_thumbnail_width_thum_key #7923

Closed
532910 opened this issue Jul 21, 2020 · 6 comments
Labels
z-bug (Deprecated Label) z-p3 (Deprecated Label)

Comments

@532910
Copy link

532910 commented Jul 21, 2020

dynamic_thumbnails are enabled
matrix-synapse 1.15.1-1~bpo10
debian buster

% curl 'https://matrix.outerface.net/_matrix/media/r0/thumbnail/outerface.net/pwJGenkxEQAsZUFtmdCjriRH?width=32&height=32'
{
    "errcode": "M_UNKNOWN",
    "error": "Internal server error"
}
2020-07-21 23:03:07,667 - synapse.http.server - 113 - ERROR - GET-160797- Failed handle request via 'ThumbnailResource': <XForwardedForRequest at 0x7f2d0c83f8d0 method='GET' uri='/_matrix/media/r0/thumbnail/outerface.net/pwJGenkxEQAsZUFtmdCjriRH?width=32&height=32' clientproto='HTTP/1.0' site=8008>
Traceback (most recent call last):
  File "/usr/lib/python3/dist-packages/synapse/http/server.py", line 81, in wrapped_request_handler
    await h(self, request)
  File "/usr/lib/python3/dist-packages/synapse/rest/media/v1/thumbnail_resource.py", line 62, in _async_render_GET
    request, media_id, width, height, method, m_type
  File "/usr/lib/python3/dist-packages/synapse/rest/media/v1/thumbnail_resource.py", line 175, in _select_or_generate_local_thumbnail
    url_cache=media_info["url_cache"],
  File "/usr/lib/python3/dist-packages/synapse/rest/media/v1/media_repository.py", line 495, in generate_local_exact_thumbnail
    media_id, t_width, t_height, t_type, t_method, t_len
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 634, in simple_insert
    yield self.runInteraction(desc, self.simple_insert_txn, table, values)
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 527, in runInteraction
    **kwargs
  File "/usr/lib/python3/dist-packages/twisted/internet/defer.py", line 1416, in _inlineCallbacks
    result = result.throwExceptionIntoGenerator(g)
  File "/usr/lib/python3/dist-packages/twisted/python/failure.py", line 491, in throwExceptionIntoGenerator
    return g.throw(self.type, self.value, self.tb)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 575, in runWithConnection
    self._db_pool.runWithConnection(inner_func, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 250, in inContext
    result = inContext.theWork()
  File "/usr/lib/python3/dist-packages/twisted/python/threadpool.py", line 266, in <lambda>
    inContext.theWork = lambda: context.call(ctx, func, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 122, in callWithContext
    return self.currentContext().callWithContext(ctx, func, *args, **kw)
  File "/usr/lib/python3/dist-packages/twisted/python/context.py", line 85, in callWithContext
    return func(*args,**kw)
  File "/usr/lib/python3/dist-packages/twisted/enterprise/adbapi.py", line 306, in _runWithConnection
    compat.reraise(excValue, excTraceback)
  File "/usr/lib/python3/dist-packages/twisted/python/compat.py", line 464, in reraise
    raise exception.with_traceback(traceback)
  File "/usr/lib/python3/dist-packages/twisted/enterprise/adbapi.py", line 297, in _runWithConnection
    result = func(conn, *args, **kw)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 572, in inner_func
    return func(conn, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 418, in new_transaction
    r = func(cursor, *args, **kwargs)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 653, in simple_insert_txn
    txn.execute(sql, vals)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 210, in execute
    self._do_execute(self.txn.execute, sql, *args)
  File "/usr/lib/python3/dist-packages/synapse/storage/database.py", line 236, in _do_execute
    return func(sql, *args)
psycopg2.IntegrityError: duplicate key value violates unique constraint "local_media_repository_thumbn_media_id_thumbnail_width_thum_key"
DETAIL:  Key (media_id, thumbnail_width, thumbnail_height, thumbnail_type)=(pwJGenkxEQAsZUFtmdCjriRH, 32, 32, image/png) already exists.
@anoadragon453
Copy link
Member

Context: #2182 (comment)

@532910
Copy link
Author

532910 commented Jul 28, 2020

update to 1.17.0-1~bpo10+ didn't change anything

@richvdh
Copy link
Member

richvdh commented Sep 8, 2020

fixed by #7124.

@richvdh richvdh closed this as completed Sep 8, 2020
@532910
Copy link
Author

532910 commented Sep 17, 2020

Still see this issue on 1.19.1-1~bpo10+2 debian stable. Should it be fixed there?

@erikjohnston
Copy link
Member

No, unfortunately it also looks like it won't be in v1.20 either, as that release is taking forever to get out of RC. Should be in v1.21 though.

@532910
Copy link
Author

532910 commented Nov 19, 2020

It looks like this is fixed. Anyway I don't see this error more.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
z-bug (Deprecated Label) z-p3 (Deprecated Label)
Projects
None yet
Development

No branches or pull requests

4 participants