Skip to content

feat: migrate from rouille to warp - #3009

Draft
drahnr wants to merge 46 commits into
mainfrom
bs-cont-rouille-to-warp-migration-2241
Draft

drahnr wants to merge 46 commits into
mainfrom
bs-cont-rouille-to-warp-migration-2241

Conversation

@drahnr

@drahnr drahnr commented Nov 8, 2026 •

Copy link
Copy Markdown
Collaborator

Replaces rouille with warp as our primary request/response handler framework.

Part of porting changes from cachepot #1620
The original PR is here paritytech/cachepot#131

Supersedes #2241 with all fixes included.

Initial porting was done by @Saruniks
Original work was done by @montekki

drahnr and others added 8 commits November 7, 2026 17:48
Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
Co-authored-by: Fedor Sakharov <fedor.sakharov@gmail.com>
Fall back to the environment passed to NVCC when dry-run output omits PATH, while preserving explicit dry-run overrides. Return executable lookup errors instead of panicking when PATH is absent.
@codecov-commenter

codecov-commenter commented Nov 8, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 93.23017% with 105 lines in your changes missing coverage. Please review.
✅ Project coverage is 81.94%. Comparing base (0e8f184) to head (9162aa0).
⚠️ Report is 6 commits behind head on main.

Files with missing lines Patch % Lines
src/bin/sccache-dist/main.rs 58.33% 30 Missing ⚠️
tests/sccache_dist.rs 93.80% 22 Missing ⚠️
src/bin/sccache-dist/startup.rs 96.24% 13 Missing ⚠️
src/bin/sccache-dist/server_tests.rs 94.59% 10 Missing ⚠️
src/dist/client_auth.rs 0.00% 9 Missing ⚠️
tests/system.rs 88.70% 7 Missing ⚠️
src/bin/sccache-dist/token_check.rs 97.16% 4 Missing ⚠️
tests/harness/mod.rs 95.50% 4 Missing ⚠️
tests/util/mod.rs 87.87% 4 Missing ⚠️
src/cache/gha.rs 0.00% 1 Missing ⚠️
... and 1 more
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3009      +/-   ##
==========================================
+ Coverage   79.99%   81.94%   +1.95%     
==========================================
  Files          76       81       +5     
  Lines       47373    50243    +2870     
==========================================
+ Hits        37894    41173    +3279     
+ Misses       9479     9070     -409     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@drahnr
drahnr marked this pull request as ready for review November 10, 2026 14:24
Copilot AI balanced review requested due to automatic review settings November 10, 2026 14:24

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Blocking build/cache operations and unbounded upload buffering risk server stalls and memory exhaustion, while Accept negotiation and upload timing introduce compatibility and job-expiration regressions.

1 open issue
What changed in this PR

Migrates sccache’s distributed HTTP services from Rouille to Warp, continuing the cachepot port tracked in #1620 and superseding #2241.

Changes:

  • Converts distributed handlers, authentication requests, and server startup to async execution.
  • Adds HTTP regression tests and adapts distributed integration tests to Tokio.
  • Also fixes NVCC executable lookup when dry-run output omits PATH, with regression tests.
File Description
tests/​harness/​mod.rs Uses async server tasks, HTTP checks, and readiness polling.
tests/​dist.rs Converts distributed tests to async execution and serializes them.
src/​util.rs Replaces the blocking HTTP client helper with an async client.
src/​lib.rs Removes the Rouille macro import.
src/​dist/​mod.rs Updates distributed traits and reader bounds for async handlers.
src/​dist/​http.rs Implements Warp routes, async requests, and HTTP regression tests.
src/​dist/​client_auth.rs Makes OAuth token exchange asynchronous.
src/​compiler/​nvcc.rs Adds inherited PATH fallback and executable-lookup tests.
src/​bin/​sccache-dist/​token_check.rs Converts remote token checks to async and adds tests.
src/​bin/​sccache-dist/​main.rs Integrates Tokio runtimes and async distributed handlers.
Cargo.toml Replaces Rouille with Warp and updates dependency features.
Cargo.lock Records the updated dependency graph.

Review effort: Balanced

Comment thread src/bin/sccache-dist/main.rs Resolved
Keep runtime and authentication initialization in the daemon, and report readiness or startup errors to the original process.
Move synchronous builds off Tokio workers with owned inputs, and gate imports and compiler fields by their features.
Keep runtime and authentication initialization in the daemon, and report readiness or startup errors to the original process.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unbounded request buffering can exhaust server memory, synchronous cache work can starve Tokio workers, and request cancellation can skip job completion updates, leaving scheduler capacity occupied.

1 open issue
1 resolved since last review

Review effort: Balanced

Comment thread src/bin/sccache-dist/main.rs Resolved
@drahnr
drahnr marked this pull request as draft November 13, 2026 07:23
Use daemonix start and execute directly while preserving FD cleanup and crash setup in both foreground and daemon modes. Document the readiness handshake and cover foreground cleanup in isolated subprocess tests.
Acquire the toolchain-cache mutex and check membership on the blocking pool so unpacking cannot stall HTTP workers or heartbeats. Keep job-map updates async and test contended assignments for cached and missing toolchains on a current-thread runtime.
…ist-daemon-fd-fun

# Conflicts:
#	src/bin/sccache-dist/main.rs
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.
@sylvestre

Copy link
Copy Markdown
Collaborator

sorry but it needs to be rebased

Comment thread Cargo.toml
syslog = { version = "7", optional = true }
thiserror = { version = "1.0.63", optional = true }
version-compare = { version = "0.1.1", optional = true }
warp = { version = "0.3.7", optional = true, features = ["tls"] }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why warp 0.3? it pulls hyper 0.14, http 0.2, rustls 0.22 and tokio-rustls 0.25 next to the hyper 1 stack we already have.
warp 0.4 is on hyper 1, could we use it?

Comment thread Cargo.toml
rcgen = { version = "0.14", optional = true }
rsa = { version = "0.9.2", optional = true }
syslog = { version = "7", optional = true }
thiserror = { version = "1.0.63", optional = true }

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thiserror 2 is already in the tree, please use it instead of adding 1.0

Comment thread Cargo.toml
# dynamically or statically.
vendored-openssl = ["openssl?/vendored", "reqwest?/native-tls-vendored"]
# Dummy feature for backwards compatibility.
vendored-openssl = []

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this PR also contains #2325 (openssl removal), #3015 (startup handshake) and #3057 (test command helpers).
Please split, or rebase once they are merged, so that this one is only rouille -> warp

Comment thread src/dist/http.rs
.and_then(authorize)
.and(with_server_incoming_handler(handler))
.and(with_requester(requester))
.and(warp::body::bytes())

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warp::body::bytes() loads the whole toolchain into memory, while rouille streamed it into the reader.
Toolchains can be hundreds of MB, and there is no content_length_limit either. Could we stream the body instead?

Comment thread src/dist/http.rs

panic!("Rouille server terminated")
panic!("Warp server terminated")

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

could it return an error instead of panic? the signature is already Result

Comment thread src/compiler/rust.rs
{
// Taken from Cargo
let host = rustc_verbose_version
let _host = rustc_verbose_version

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

_host that is used afterwards is confusing.
Also, these cfg(dist-client) cleanups are unrelated to warp, please move them into a separate PR

@drahnr

drahnr commented Nov 27, 2026 •

Copy link
Copy Markdown
Collaborator Author

@sylvestre I think you're review was a bit early, this is intentionally a draft because it depends on #2325 #3015 and #3057 and I didn't get around to do a full self review.
I also merged back those PRs into this one to avoid drift - I keep/kept the non-draft ones up to date with the main-branch.

sorry but it needs to be rebased

I remember agreeing that rebasing is a last resort, since gh can't handle the mapping of commits across rebases? I am happy to rebase once I did a self-review. I don't really have a strong preference.

What I'd really like though, is to redirect your attention to the pre-requisites in #2325 #3015 and #3057 , to get them over the finish line.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants