Skip to content

fall back locally on server connection/startup failures#2756

Open
ken-matsui wants to merge 1 commit into
mozilla:mainfrom
ken-matsui:fallback-server-connection-error
Open

fall back locally on server connection/startup failures#2756
ken-matsui wants to merge 1 commit into
mozilla:mainfrom
ken-matsui:fallback-server-connection-error

Conversation

@ken-matsui

Copy link
Copy Markdown

README.md states:

To have sccache instead gracefully failover to the local compiler without stopping, set the environment variable SCCACHE_IGNORE_SERVER_IO_ERROR=1.

This patch extends this behavior to failures that happen during connect_or_start_server.

README.md states:

    To have sccache instead gracefully failover to the local compiler
    without stopping, set the environment variable
    `SCCACHE_IGNORE_SERVER_IO_ERROR=1`.

This patch extends this behavior to failures that happen during
connect_or_start_server.
@codecov-commenter

codecov-commenter commented Jun 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 73.32%. Comparing base (68cd330) to head (337efdd).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2756      +/-   ##
==========================================
- Coverage   74.18%   73.32%   -0.86%     
==========================================
  Files          71       71              
  Lines       40491    40554      +63     
==========================================
- Hits        30037    29736     -301     
- Misses      10454    10818     +364     

☔ 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.

@ken-matsui

Copy link
Copy Markdown
Author

Hi @sylvestre, the CI error looks unrelated to this patch. Could you please rerun it and review this? Thank you!

@ken-matsui

Copy link
Copy Markdown
Author

Ping @sylvestre

anthonyshew added a commit to vercel/sccache that referenced this pull request Jul 7, 2026
…lures

Hand-applied port of mozilla#2756 (which is stacked on the
unmerged client-side-mode PR upstream) onto the v0.16.0 base: when the
client cannot connect to or start the background server and
SCCACHE_IGNORE_SERVER_IO_ERROR is set, warn and run the compiler
directly instead of failing the compilation. Without this, a storage
self-check failure at server startup (e.g. an unreachable or
unauthorized cache backend) makes every wrapper invocation exit 2 and
fails the build — an optimization must never do that.
anthonyshew added a commit to vercel/turborepo that referenced this pull request Jul 7, 2026
> Stacked on #13298 (retargets to main when it merges).

## Why

Bench run
[28839285743](https://github.com/vercel/turborepo/actions/runs/28839285743)
exposed the compile cache's worst failure mode: with unauthorized
credentials, sccache's background server failed its storage self-check
at startup, refused to start, and every wrapper invocation exited 2 —
cargo saw failed rustc calls and **the build failed**. An optimization
must degrade to "slower", never to "broken".

## What

Two independent layers:

1. **Don't start when the run already knows the backend is doomed.** The
proxy gate now checks the resolved runtime `RemoteCacheStatus` (which
folds in the preflight: auth failure, unreachable API, team over
limit/paused) instead of configuration alone. The bench run had
literally printed `Remote caching unavailable (Authentication failed)`
before starting the proxy anyway.
2. **Don't die when it breaks mid-run.** The fork picks up a port of
mozilla/sccache#2756 (hand-applied to the v0.16.0 base — upstream it's
stacked on the unmerged client-side-mode PR): with
`SCCACHE_IGNORE_SERVER_IO_ERROR=1` — now injected — a client that cannot
connect to or start the server warns and runs the compiler directly.
Covered by two integration tests on the fork (forced startup failure →
fallback with the env var, hard error without).

Also tightens #13298's `CARGO_INCREMENTAL` tolerance: reading sccache's
wrapper source revealed it **hard-exits** on `CARGO_INCREMENTAL=1`, so
tolerating arbitrary pre-set values could itself fail builds. Only an
ambient `0` composes; any other explicit value stands the injection down
(incremental compilation was deliberately requested and is incompatible
with sccache).

## How

Layer 1 kills the predictable class before any wrapper runs; layer 2 is
the guarantee for everything unpredictable. Fork rev bumped to `52bfcd0`
(`vercel/main-from-args`). Verified: fork integration tests for the
fallback both ways; `compile_cache_env` matrix updated (`=0` tolerated,
`=1` stands down); workspace check/lint/fmt green.
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.

2 participants