Repository navigation
signalmeow/attachments: treat 403 from CDN 0 as not found - #737
Merged
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Logs
Failed to handle attachmentwas logged 849 times in the 24 h ending Nov 14 06:00 UTC, against 232 the day before. In a sample of four 15-minute windows on separate clusters there were 341 lines from at least 4 accounts, allunexpected status code 403(some wrapped aswrite callback failed: ...). They came from backward backfill and backup chat import of messages that are months to years old. The debug response bodies show that CDN 0 returns 403 with an S3AccessDeniederror for an expired attachment, while cdn2 and cdn3 return 404 for the same case.Cause
DownloadAttachmentreturnsErrAttachmentNotFoundonly for 404. A missing object on CDN 0 therefore surfaces as a generic error. The user sees "Failed to handle attachment : unexpected status code 403" instead of "Attachment no longer available", and stickers skip the sticker-pack fallback. Signal Desktop also treats a CDN 0 403 as equivalent to a 404 (downloadAttachment.preload.ts).Change
Return
ErrAttachmentNotFoundfor a 403 from CDN 0/1 (same host), matching Signal Desktop. Also fix the CDN index bound check inGetAttachment, which indexed pastCDNHostsforcdn_number4.Before / after
Note: not tested against a live account.
Tag
@indentto continue the conversation here.