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

if remote media cache is deleted on the fs, the server should notice and redownload (SYN-709) #1555

Open
matrixbot opened this issue Jun 12, 2016 · 10 comments
Labels
A-Media-Repository Uploading, downloading images and video, thumbnailing S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.

Comments

@matrixbot
Copy link
Member

Submitted by @​matthew:matrix.org

(Imported from https://matrix.org/jira/browse/SYN-709)

@matrixbot matrixbot changed the title if remote media cache is deleted on the fs, the server should notice and redownload (SYN-709) if remote media cache is deleted on the fs, the server should notice and redownload (https://github.com/matrix-org/synapse/issues/1555) Nov 7, 2016
@matrixbot matrixbot changed the title if remote media cache is deleted on the fs, the server should notice and redownload (https://github.com/matrix-org/synapse/issues/1555) if remote media cache is deleted on the fs, the server should notice and redownload (SYN-709) Nov 7, 2016
@Ezwen
Copy link

Ezwen commented Nov 13, 2017

Such feature would be great, I lost part of my media folder by mistake, and now riot is confused for some avatars and room icons.

Is there any workaround for such case, like a postgre script/query to properly remove missing (or even all) remote media and make synapse consequently re-download them?

@ordinarygulp
Copy link

Is this still an issue? Because we recently moved servers, while cloning the data, and now some avatars not registered with our homeserver are missing. Seems related to #3479 as well.

@aaronraimist
Copy link
Contributor

Yes it is still an issue (that's why it is open). If you didn't move all the data the then you essentially deleted it manually which Synapse doesn't like. You can use the purge remote media API to get avatars back. https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_remote_media.rst

Use a time in the future.

#synapse:matrix.org is a better place for support.

@anoadragon453
Copy link
Member

You can use the purge remote media API to get avatars back. https://github.com/matrix-org/synapse/blob/master/docs/admin_api/purge_remote_media.rst

Note that this doc file has moved to https://github.com/matrix-org/synapse/blob/develop/docs/admin_api/media_admin_api.md#purge-remote-media-api.

@PC-Admin
Copy link

PC-Admin commented Apr 27, 2021

Noticed this bug myself recently when using the purge API. We purged everything on perthchat.org until 30 days ago, then deleted all the empty folders in the media repo.

We then noticed most of the remote avatars for users/rooms were not rendering. Upon attempting to load them postgresql produces this error:

Apr 27 06:30:32 perthchat matrix-postgres[29502]: 2021-04-27 06:30:32.208 UTC [29] DETAIL:  Key (media_origin, media_id)=(gomatrixhosting.com, SCCSVfsybyCRyYvtFdRnMjmh) already exists.
Apr 27 06:30:32 perthchat matrix-postgres[29502]: 2021-04-27 06:30:32.208 UTC [29] STATEMENT:  INSERT INTO remote_media_cache (media_origin, media_id, media_type, media_length, created_ts, upload_name, filesystem_id, last_access_ts) VALUES('gomatrixhosting.com', 'SCCSVfsybyCRyYvtFdRnMjmh', 'image/png', 248309, 1619505032207, 'PNG_File_trimmed.png', 'bQqYeuCbiMGwIOzviBJUAwMO', 1619505032207)

Can confirm that purging to a future date does in fact fix this. :)

@clokep clokep added S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues. labels Apr 27, 2021
@gbolcer
Copy link

gbolcer commented Oct 15, 2021

Purge command appears to succeed. Returns deleted:0. Element.io client still does not return corrected images.
I need to confirm what server Synapse server versions have this fixed.

{
"deleted": 0
}

@aaronraimist
Copy link
Contributor

@gbolcer deleted 0 means you didn't delete any. The most common reason for this is providing a timestamp in seconds rather than milliseconds.

@gbolcer
Copy link

gbolcer commented Oct 15, 2021

@aaronraimist
Copy link
Contributor

@gbolcer yes but in the wrong format. The API wants milliseconds. In milliseconds 1634329818 is Jan 19, 1970 which is probably not the day you were trying to use.

@gbolcer
Copy link

gbolcer commented Oct 15, 2021

Thank you @aaronraimist Nice catch.

{
"deleted": 3759
}

Confirmed, all icons repopulated!

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
A-Media-Repository Uploading, downloading images and video, thumbnailing S-Minor Blocks non-critical functionality, workarounds exist. T-Defect Bugs, crashes, hangs, security vulnerabilities, or other reported issues.
Projects
None yet
Development

No branches or pull requests

9 participants