Repository navigation
feat/startup: add domain socket for daemon launch to funnel information - #3015
Merged
Merged
Conversation
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #3015 +/- ##
==========================================
+ Coverage 79.99% 80.47% +0.48%
==========================================
Files 76 78 +2
Lines 47373 48280 +907
==========================================
+ Hits 37894 38855 +961
+ Misses 9479 9425 -54 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
Keep runtime and authentication initialization in the daemon, and report readiness or startup errors to the original process.
drahnr
force-pushed
the
bs-dist-daemon-fd-fun
branch
from
November 12, 2026 16:13
ae101af to
3b657d6
Compare
drahnr
commented
Nov 12, 2026
…ist-daemon-fd-fun # Conflicts: # src/bin/sccache-dist/main.rs
drahnr
marked this pull request as ready for review
November 24, 2026 16:37
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
There are no active review issues with the daemon startup handshake changes.
No open issues 🎉
What changed in this PR
This PR adds a Unix-domain socket handshake between the scheduler daemon and its launcher so startup failures reach the invoking command. It prepares for the HTTP migration in #2241 by moving authentication initialization after daemonization.
Changes:
- Wait for daemon readiness and propagate startup errors, with a timeout and watchdog.
- Preserve foreground operation while separating daemonization from cleanup.
- Add startup, authentication, and process-cleanup tests, and document launcher behavior.
| File | Description |
|---|---|
tests/sccache_dist.rs |
Tests error reporting, readiness, and closed standard descriptors. |
tests/dist_daemon.rs |
Tests detached initialization, JWT authentication, and process cleanup. |
src/util.rs |
Separates parent-aware daemonization from post-fork cleanup. |
src/dist/http.rs |
Adds a readiness callback after scheduler listener setup. |
src/bin/sccache-dist/startup.rs |
Implements startup messaging, acknowledgment, timeout, and watchdog. |
src/bin/sccache-dist/main.rs |
Routes scheduler initialization through the startup handshake. |
docs/DistributedQuickstart.md |
Documents startup waiting and failure reporting. |
Review effort: Balanced
sylvestre
reviewed
Nov 24, 2026
Keep startup failures, readiness, JWT authentication, descriptor cleanup, and detachment checks in one integration target. Exercise launcher loss during blocked JWKS retrieval and serialize descendant cleanup.
Reject malformed, truncated, oversized, and empty-error startup responses and incorrect readiness confirmations. Synchronize watchdog setup with blocking runtime work and bound child-process waits.
Collaborator
|
Thanks for your PR |
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.
Currently early daemon issues are swallowed, since we daemonize rather early on.
Once we land we #2241 it's getting more pressing due to the non-fork-compatibility of tokio (see process global state which is assume to remain alive without access from outside
https://github.com/tokio-rs/tokio/blob/tokio-1.54.1/tokio/src/signal/registry.rs#L144-L151 and the issue tokio-rs/tokio#4301). We would be able to pass file descriptors to retain into
daemonize, but we don't have access to those, neither directly or indirectly. Writing pre and post runtime init is hacky and brittle, so I'd rather not.I pulled this PR out from as a prequel to #2241 to a) ensure not introducing any error conditions and b) retaining a more manageable changeset size.
Assuming the tokio runtime would already be present as per #2241
becomes
Failure paths
The background startup timeout is 60 seconds (= EOF before readiness | invalid response | missing ack(
Foreground mode
Foreground mode does not fork or require the background startup handshake.