Repository navigation
Description
We (https://github.com/scylladb/scylladb/) are using a ninja-based build system for C++ and Rust code, and using sccache for caching the compilations. Most developers do not use a remote compilation or caching setup - the cache is local and compilations are run on the same machine.
Our developers working interactively are facing an annoying problem: When we interrupt "ninja" with control-C, ninja is killed immediately, but all the ongoing compilations continue to run to completion, in the background. These compilations sometimes linger for several minutes (!), continuing to hog the machine's CPU and memory long after the user interrupted them.
The reason for this problem is sscache's server architecture: An sscache invoked by ninja may connect to some sscache server started earlier and run the build there. A control-C will never reach that other process group, and won't kill the build. Even no server exists, a new one will be started but by default will be run in a separate process group (SCCACHE_NO_DAEMON=1 can be used to avoid that).
It is hard for me to believe that we're the only people who are having this problem, and I wonder if anyone solved it somehow.
I wanted to suggest a command-line option (or environment variable) that simply doesn't use a build server at all - each "sccache" invocation would just work separately (just sharing the cache directory), just as the old "ccache" did. Compilations are run in the foreground, and control-C kills them all.
Or do you have a better suggestion? In scylladb/scylladb#30552 I came up with a rather ugly workaround using SCCACHE_NO_DAEMON=1 (to ensure that the server that does start, is in this process group) and SCCACHE_SERVER_UDS (to avoid using some other build's server), but it's not pretty - both in how it's used, and how it behaves, and I was hoping for something better.
Metadata
Metadata
Assignees
Labels
Type
Fields
Priority
Activity
sylvestre commentedon Jul 1, 2026
this should be fixed by #2735
nyh commentedon Jul 1, 2026
Thanks. Is there any documentation what this "client side mode" does, and how to use it? I didn't understand from that pull request what it is about.
trxcllnt commentedon Jul 1, 2026
I fixed this in our NVIDIA fork by aborting the tokio task and killing the associated subprocesses if a client disconnects. I isolated the fix to a single commit here. @sylvestre is it worth submitting a PR so users don't have to opt-in to this by default?
sylvestre commentedon Jul 1, 2026
see: https://github.com/sylvestre/sccache/blob/7f98f1ed9a64a36f13840e9bdcea2ef8fe515e4c/docs/Architecture.md
tldr: the client manages the compilation instead of the server
Sounds good :) don't hesitate to submit more PR ;)
trxcllnt commentedon Jul 1, 2026
Ok, PR is here #2761
nyh commentedon Oct 7, 2026
Thanks! Just writing back that the new code is working beautifully (I tested on sccache 0.17.0) - when I interrupt my build with control-C, sccache kills all the compilation processes immediately, and they don't linger on for minutes as they did in the past. Very nice.