-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Consecutive remote media thumbnail requests with different methods fails #8649
Comments
looks like it didn't get correctly removed in #7124 |
https://github.com/matrix-org/synapse/pull/7124/files#diff-f05c2d0a285e2b60b93cbffe6283864c9b23c19984fe7e4511604797413acc06R83 tries to remove the old constraint but doesn't take into account the fact that (I think) the constraint might have a different name under postgres and sqlite. |
@deepbluev7 any chance you'd be willing to take a look at this? |
@clokep I think removing both of the old constraints instead should work in that case? I had no idea, that the constraints could have different names and I still don't understand, why they would. I'm a bit busy currently though, so it may be easier for someone else to add a migration, that deletes both of the old indices, if they exist, since it will take me quite a while to context switch into synapse db migration code again. |
I suspect they can end up with different names depending on whether you're using sqlite or postgres? |
Sorry to bringing this up, but has anyone found any workaround for this?? I have millions of lines on synapse's log file in the last month. |
I think the thing to do here is check what the name of the old constraint is on sqlite and add a delta that removes that (similar to what was done in #7124). |
From the Polynomial Supporters channel someone else and me noticed this problem today as well - the thumbnails for the flairs are missing and represented with the alt text instead.
This is on Synapse 1.30.1. |
ugh this is one of those bugs that is one line to fix. I'll have a go at it now. |
The `remote_media_cache_thumbnails_media_origin_media_id_thumbna_key` constraint is superceded by `remote_media_repository_thumbn_media_origin_id_width_height_met` (which adds `thumbnail_method` to the unique key). PR #7124 made an attempt to remove the old constraint, but got the name wrong, so it didn't work. Here we update the bg update and rerun it. Fixex #8649.
There's a lot of chat in the above about sqlite. It was nothing to do with sqlite, because on sqlite we have a completely different implementation which rebuilds the tables (https://github.com/matrix-org/synapse/pull/7124/files#diff-fdc2e6526e108bf9b08a63532dc6f44e388d929ae3ea1a6863939f7fe1b9ef8eR36-R44). AFAICT this was a simple case of using the wrong name in the migration. Those that want a manual workaround can run the following sql: ALTER TABLE remote_media_cache_thumbnails
DROP CONSTRAINT remote_media_cache_thumbnails_media_origin_media_id_thumbna_key; |
Thank you! |
The `remote_media_cache_thumbnails_media_origin_media_id_thumbna_key` constraint is superceded by `remote_media_repository_thumbn_media_origin_id_width_height_met` (which adds `thumbnail_method` to the unique key). PR #7124 made an attempt to remove the old constraint, but got the name wrong, so it didn't work. Here we update the bg update and rerun it. Fixes #8649.
I just noticed the same exceptions in the logs even after upgrading to 1.33.2, so there might be some edge-case in which that PR doesn't actually end up dropping the constraint? Works fine after dropping it manually though. |
@kyrias: can you confirm the exact text of the exception that you saw in the logs? can you also share the results of |
And the
|
That's... odd. If you still have synapse logs for the point when you first upgraded to 1.32.0 or later, they might be interesting. Otherwise, 🤷♂️ |
Description
It seems like the method column is missing on the unique constraint on
remote_media_cache_thumbnails
, causing internal server errors when trying to fetch the same size of the same thumbnail with different methods.Steps to reproduce
Fetch a thumbnail of a remote image using some specific size and method (scale or crop).
Fetch a thumbnail of the same image and same size, but specify a different method.
Receive M_UNKNOWN, Internal server error
Here's the error from server logs:
Added comments from tulir:
"someone forgot the
thumbnail_method
from the unique constraint""wait no, there are two unique constraints, one with and one without
thumbnail_method
? :D"Version information
Homeserver: hacklab.fi
Version: 1.21.2
The text was updated successfully, but these errors were encountered: