Repository navigation
fix(service): reject objects exceeding MAX_OBJECT_SIZE - #230
Merged
Merged
Conversation
Reject objects larger than MAX_OBJECT_SIZE (1 TiB - 1 byte), matching the 40-bit object_size field in CacheValueHeader, instead of caching them in memory and silently dropping them during disk eviction. Closes #217
[Medium impact] The PR appears safe to merge. SummaryRejects objects larger than
Reviews (1) · Last reviewed commit: "fix(service): reject objects exceeding M..." · Reviewed by Greptile |
Merged
shikhar
pushed a commit
that referenced
this pull request
Nov 20, 2026
## 🤖 New release * `cachey`: 0.13.5 -> 0.13.6 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.13.6](0.13.5...0.13.6) - 2026-11-20 ### Fixed - *(service)* reject objects exceeding MAX_OBJECT_SIZE ([#230](#230)) - *(object_store)* re-validate rescues, cap timeout allowance, and require admission for overload copies ([#229](#229)) - *(service)* bound max_attempts in C0-Config and retry overrides ([#228](#228)) ### Other - *(deps)* upgrade dependencies ([#226](#226)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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
CacheValueHeaderstoresobject_sizein 40 bits (up to1 TiB - 1), so objects of size>= 1 TiBwere cached in memory and then silently dropped when evicted to foyer's disk cache.This change keeps the on-disk format untouched and explicitly rejects objects larger than
MAX_OBJECT_SIZE((1 << 40) - 1) up front:MAX_OBJECT_SIZE = MAX_RANGE_END - 1((1 << 40) - 1) insrc/service/mod.rsand share it withCacheValueHeader::new(with a compile-time< (1 << 40)assertion).DownloadError::ObjectTooLarge { object_size, max_object_size }and reject oversized objects inDownloader::download, inDownloader::read_response(before allocating/streaming the body), and inCacheyService::get.C0-Object-Size > MAX_OBJECT_SIZEwith400 Bad RequestinObjectSizeHeader, and mapDownloadError::ObjectTooLargeto422 Unprocessable Entity(object_too_large) inon_chunk_error.Verification
cargo +nightly fmtcargo clippy --locked --all-features --all-targets -- -D warnings --allow deprecatedcargo deny checkcargo nextest run --locked --libCloses #217