wip: do most of the processing on the client side - instead of the server#2642
Closed
sylvestre wants to merge 8 commits intomozilla:mainfrom
Closed
wip: do most of the processing on the client side - instead of the server#2642sylvestre wants to merge 8 commits intomozilla:mainfrom
sylvestre wants to merge 8 commits intomozilla:mainfrom
Conversation
- Replace block_in_place with pool.block_on to avoid hanging when no tokio runtime context is available during cache initialization. - Add 30s timeout to the HTTP client used for TaskCluster token fetch to prevent indefinite hangs when the endpoint is unreachable.
…jectSource serializable - Fix from_bytes: previously passed pre-built bytes into a ZipWriter, which would append zip metadata on finish(), corrupting the data. Now stores them in a `prebuilt` field and returns them unchanged. - Derive Serialize/Deserialize on FileObjectSource so it can be used in the IPC protocol for client-side compilation.
Redesign the client-side compilation protocol to avoid transferring large artifacts over IPC: - CacheGetRequest now includes output_paths so the server can extract artifacts directly to disk on a cache hit. - CacheGetResponse::Hit now carries only stdout/stderr instead of the full cache entry bytes. - CachePutRequest now includes output_paths (for the server to read from disk) plus stdout/stderr, replacing the raw entry bytes. This relies on client and server sharing the same filesystem, which is always the case since they run on the same machine. Note: this commit temporarily breaks compilation of server.rs; the next commit updates the server handlers to match.
- Remove IPC frame size limit (use usize::MAX) so large cache entries can be transferred when needed. - handle_cache_get: extract artifacts directly to client-supplied paths on disk, returning only stdout/stderr over IPC. - handle_cache_put: read output artifacts from disk, pack into a cache entry with stdout/stderr, and store to the backend. Errors are logged but don't crash the connection (best-effort caching).
Replace the stub that fell back to server-side compilation with the full client-side flow: 1. Detect the compiler locally. 2. Parse arguments and bail out for non-cacheable invocations. 3. Run the preprocessor and compute the BLAKE3 cache key using a NoopStorage (real cache I/O goes through the server). 4. Send CacheGet to the server; on a hit the server extracts artifacts to disk and returns only stdout/stderr. 5. On a miss, compile locally and send CachePut so the server can read output files from disk and store them.
- Replace flowcharts with sequence diagrams for both compilation modes - Add colored styling to mermaid diagrams - Document C/C++ vs Rust cache key generation differences - Add performance note for client-side preprocessing - Update "foundational stage" note to reflect current implementation
The per-feature cargo test matrix was failing because tests depend on features not included in the individual feature flag. Revert to cargo check which validates compilation without running tests.
Mark test_server_unsupported_compiler and test_server_compile with #[serial] and explicitly unset SCCACHE_CLIENT_SIDE_COMPILE so they exercise the server-side compilation path regardless of the environment.
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2642 +/- ##
==========================================
- Coverage 73.37% 72.94% -0.43%
==========================================
Files 68 69 +1
Lines 37337 37582 +245
==========================================
+ Hits 27395 27415 +20
- Misses 9942 10167 +225 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
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.
see https://github.com/sylvestre/sccache/blob/97483f6178a4253990364025705b26d74c84eaf9/docs/Architecture.md for the description of the change