Repository navigation
docs(r2): describe R2's 503 as ServiceUnavailable, not a rate limit - #249
Merged
Merged
Conversation
R2 documents exactly one 503 code, ServiceUnavailable ("Service is
temporarily unavailable", retry with exponential backoff). Its rate
limit is 429 TooManyRequests, and SlowDown is AWS S3's code, not R2's.
The R2Error/R2GetError docs called 503 "R2's overload / SlowDown",
which the witness uploader took as a rate-limit signal.
Correct both doc comments, note that only a 429 says anything about
the client's own load, and make the 503 test mocks answer
ServiceUnavailable. Classification is unchanged: 429 and every 5xx
remain backoff-worthy.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contributor
Claude review status
✅ Review clean Last reviewed: head New this round: 0 finding(s), 0 question(s) · Resolved this round: 0 · Open questions: 0 |
|
This PR currently has no labels, but it should have at least:
None of the other labels ( |
Troublor
approved these changes
Nov 27, 2026
RealiCZ
approved these changes
Nov 27, 2026
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.
Summary
R2Error::ThrottledandR2GetError::Throttleddoc comments instateless-r2, which called 503 "R2's503overload /SlowDown".10043 ServiceUnavailable: "Service is temporarily unavailable", with the fix "Retry with exponential backoff". R2's rate limit is42910058 TooManyRequests(for example, more than 1 write per second to the same key).SlowDownis AWS S3's throttling code and does not appear in R2's error-code tables.Throttleddoc now also says that only a429reflects the client's own load. A caller that pauses all of its requests, rather than backing off the one that failed, should decide that fromstatus, not from the variant.SlowDownnow answerServiceUnavailable, so the fixtures match what R2 actually returns.No behavior change:
is_throttle_statusstill treats429and every5xxas backoff-worthy.Why
The replay witness uploader writes through this crate. It took the old wording at face value and treated a
503as a rate limit, pausing every upload for 30 seconds. On testnet, two single503s stopped witness uploads for about 30 seconds each, and the stateless validator stalled for 37 s and 43 s while it waited for those witnesses. The uploader fix is a separate PR in mega-reth.References: https://developers.cloudflare.com/r2/api/error-codes/ , https://developers.cloudflare.com/r2/platform/limits/
Testing
cargo test -p stateless-r2(55 passed)cargo clippy -p stateless-r2 --all-targets --all-features,cargo fmt --all --check🤖 Generated with Claude Code