Repository navigation
Conversation
00c9b8e to
65fc778
Compare
65fc778 to
5a054f4
Compare
|
The current PR head ( |
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #2955 +/- ##
==========================================
+ Coverage 78.54% 78.62% +0.07%
==========================================
Files 74 76 +2
Lines 44039 44806 +767
==========================================
+ Hits 34591 35229 +638
- Misses 9448 9577 +129 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
thanks for looking into this! |
| let file = self | ||
| .pool | ||
| .spawn_blocking(move || -> Result<Option<File>> { | ||
| let _lock = lock_cache_directory(&root)?; |
There was a problem hiding this comment.
the same open + set_file_times under the lock is repeated in get, get_raw, get_path and get_preprocessor_cache_entry. could be dedup, no?
| .spawn_blocking(move || { | ||
| let _lock = lock_cache_directory(&root)?; | ||
| let start = Instant::now(); | ||
| let mut lru = LruDiskCache::new(&root, max_size)?; |
There was a problem hiding this comment.
LruDiskCache::new walks the whole cache dir on every put, while holding the global lock.
with a 10G cache, every cache write scans all entries and serializes all the wrappers, no?
could you please share some numbers on a real-size cache?
|
sorry but it needs to be rebased |
| .with_context(|| format!("IpcStorage::get: open {}", path.display()))?; | ||
| let file = match std::fs::File::open(&path) { | ||
| Ok(file) => file, | ||
| // A process-safe disk cache may evict the entry after the daemon |
There was a problem hiding this comment.
the daemon never builds a process-safe disk cache, so this seems unrelated to the PR. please move it into a different pr
| let (compile_resp, finished, forwarded_notification) = | ||
| runtime.block_on(service.compile_direct(compile, &mut *stderr))?; | ||
| let exit_code = if matches!(compile_resp, CompileResponse::UnhandledCompile) { | ||
| // Run unsupported compiler invocations directly. In isolated |
There was a problem hiding this comment.
this bypasses the command creator and the jobserver, and duplicates the signal handling of handle_compile_result
why not let handle_compile_result run it like the other modes do?
| let (info, cache_mode) = request_stats_with_cache_mode(srv) | ||
| .context("failed to get stats from server")?; | ||
| (info, Some(cache_mode)) | ||
| let in_process_mode = env::var("SCCACHE_IN_PROCESS").is_ok_and(|value| value == "1"); |
There was a problem hiding this comment.
please add it to Config like client_side_mode (bool_from_env_var) instead of parsing the env var by hand in 5 places
it also means SCCACHE_IN_PROCESS=true is silently ignored
| // anyways, so we can just return (mostly) empty stats directly. | ||
| Err(_) => (empty_server_info(config)?, None), | ||
| }; | ||
| stats.stats += crate::in_process_stats::read(&config.fallback_cache.dir)?; |
There was a problem hiding this comment.
with ?, a corrupted stats file breaks --show-stats in the default mode too, while add() just resets it.
maybe warn and ignore here as well?
| async fn wait(self) -> io::Result<ExitStatus> { | ||
| let Child { mut inner, token } = self; | ||
| inner.wait().await.inspect(|_ret| { | ||
| let result = if std::env::var("SCCACHE_IN_PROCESS").is_ok_and(|value| value == "1") { |
There was a problem hiding this comment.
we now have three workarounds for the same reaping issue: the 2-worker runtime, std::process for unhandled compiles, and this 10ms polling.
do we need the three of them?
also, mock_command reading SCCACHE_IN_PROCESS directly isn't great, maybe pass it through the creator?
Sandbox policies can deny local IPC while allowing access to cache storage. This adds
SCCACHE_IN_PROCESS=1so each compiler wrapper runs the compile pipeline without starting or contacting the daemon. Disk cache operations use a cross-process lock, and in-process statistics are shared across wrappers. Distributed compilation remains disabled in this mode.