You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
SCCACHE_S3_RW_MODE=READ_ONLY breaks local disk cache #2773
Hi, I was trying to configure sccache to use a multi-level cache with read-only S3 and read-write disk cache (following docs/MultiLevel.md). However, if I set S3 to be read-only, the local disk cache stops working.
To reproduce
I used an environment with latest sccache version (v0.16.0):
I think this is MultiLevelStorage::check() aggregating the levels with read-only winning, combined with the server wrapping the whole storage when the aggregate says read-only.
asyncfn check(&self) -> Result<CacheMode>{letmut result = CacheMode::ReadWrite;for(idx, level)inself.levels.iter().enumerate(){match level.check().await{Ok(CacheMode::ReadOnly) => {
result = CacheMode::ReadOnly;// any read-only level makes the whole chain read-onlydebug!("Cache level {} is read-only", idx);}// ...
So with disk,s3 and SCCACHE_S3_RW_MODE=READ_ONLY, the S3 level reports ReadOnly and the aggregate becomes ReadOnly even though the disk level is writable.
let storage = match cache_mode {CacheMode::ReadOnly => Arc::new(ReadOnlyStorage(raw_storage)),
_ => raw_storage,
which is why nothing is written to the local disk cache, matching the reported symptom.
This looks like it wants the opposite aggregation: the chain is writable if any level is writable, since put_raw / write_remaining_levels_async already skip individual read-only levels on their own.
(I ran into the same code path from a different angle while looking at per-write check() calls in the multi-level backend, filed as #2818.)
we also noticed this bug and were curious if you could merge the fix (open PR) into 0.18.0 or 0.18.1 release, please.
It seems like a quite common use case for me to have a remote cache updated by CI only while developers should be able to write their local caches without updating the remote.
Activity
multilevel: a chain with any writable level is writable
sargunv commentedon Jul 24, 2026
I just got bit by this as well, glad to see there's already a PR up!
geir-t commentedon Aug 6, 2026
I also got hit by this one. Hope the PR is OK to merge.
multilevel: a chain with any writable level is writable
multilevel: a chain with any writable level is writable
Battarshuck commentedon Aug 20, 2026
Same issue with Redis.
garysassano commentedon Aug 21, 2026
I think this is
MultiLevelStorage::check()aggregating the levels with read-only winning, combined with the server wrapping the whole storage when the aggregate says read-only.src/cache/multilevel.rsL877-L896 (v0.17.0):So with
disk,s3andSCCACHE_S3_RW_MODE=READ_ONLY, the S3 level reportsReadOnlyand the aggregate becomesReadOnlyeven though the disk level is writable.The server then wraps everything —
src/server.rsL489-L491:which is why nothing is written to the local disk cache, matching the reported symptom.
This looks like it wants the opposite aggregation: the chain is writable if any level is writable, since
put_raw/write_remaining_levels_asyncalready skip individual read-only levels on their own.(I ran into the same code path from a different angle while looking at per-write
check()calls in the multi-level backend, filed as #2818.)FabianSchurig commentedon Sep 11, 2026
Hi @sylvestre, Hi @trxcllnt,
we also noticed this bug and were curious if you could merge the fix (open PR) into 0.18.0 or 0.18.1 release, please.
It seems like a quite common use case for me to have a remote cache updated by CI only while developers should be able to write their local caches without updating the remote.
If I can support with anything, let me know.
Thanks in advance!
multilevel: a chain with any writable level is writable