Show when sccache statistics come from the no-server fallback

オープン 初心者向け
#3,095 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
77/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
rust
領域
cli, tooling

調査の方向性

src/commands.rs の Command::ShowStats から始め、サーバーなしのフォールバックを src/server.rs のテキストフォーマッターまで追ってください。既存の JSON フォールバックと終了ステータスがどのように維持されるかを確認し、稼働中のサーバーでリクエスト数がゼロの場合とサーバーなしのフォールバックを区別する、焦点を絞ったテストを追加してください。サーバーが応答しなくなった後、テキスト出力でカウンターが利用できないことが示され、JSON の動作が維持されていれば完了です。

索引モデルが issue の本文から書いたものです。

説明

Observed in CI

A successful Windows job used sccache v0.20.1 to compile its Rust targets, then ran integration tests for about 14 minutes without another compiler invocation. The last logged sccache invocation was at 07:27:42 UTC (raw line 2568). Its end-of-job JSON-based summary reported zero compiler requests at 07:41:38 (raw lines 233288–233291). That job did not print the JSON effective mode, so we cannot directly identify why its daemon stopped responding. The timing matches the default 600-second idle timeout. In a separate shorter job using the same workflow and sccache version, the summary recorded 1,330 requests.

Windows job and raw log, comparison Windows job.

Bounded reproduction

In a disposable Linux shell with v0.20.1, GCC and jq available, the following isolates the daemon and reduces the idle timeout to five seconds. This small standalone sequence is derived from the source. Our observed result is the Windows job above.

set -eu
work=$(mktemp -d)
export SCCACHE_DIR="$work/cache"
export SCCACHE_SERVER_UDS="$work/sccache.sock"
export SCCACHE_IDLE_TIMEOUT=5
export SCCACHE_CACHE_SIZE=32M
trap 'sccache --stop-server >/dev/null 2>&1 || true; rm -rf -- "$work"' EXIT
printf 'int sample(void) { return 42; }\n' > "$work/sample.c"
sccache gcc -c "$work/sample.c" -o "$work/sample.o"
sccache --show-stats --stats-format=json |
  jq '{compile_requests: .stats.compile_requests, effective_cache_mode}'
sleep 7
sccache --show-stats
sccache --show-stats --stats-format=json |
  jq '{compile_requests: .stats.compile_requests, effective_cache_mode}'

The first query should report a live mode and a positive request count. After idle shutdown, the text and JSON queries print zero counters and exit successfully. The JSON mode is null. A reader of the text sees counters that look like an idle but still-running daemon's report. The human-readable output prints the effective mode only in advanced mode and when the mode is present.

The code path is the 600-second default, the idle shutdown branch, the empty fallback in ShowStats and the text formatting branch. This is separate from the JSON mode support added for issue #2842.

Workaround and suggested change

Read effective_cache_mode from JSON and report unavailable counters when it is null. For an ephemeral CI job, set SCCACHE_IDLE_TIMEOUT at least as long as the compile-to-report interval or read the counters before a long test-only phase.

In Command::ShowStats, preserve the fallback JSON and exit status, and pass the absence of a connection to the text formatter as an explicit status. For example, print a diagnostic that the server did not respond and that the counters cannot represent previous compiler activity. Test the live server with zero requests separately from the no-server fallback. An opt-in flag that fails on a missing server could also help automation that needs a reliable cache measurement.

主要言語
Rust
スター
8k
フォーク
835
平均マージ
3日 6時間
マージ済み PR(30日)
60

環境構築

このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

mozilla/sccache のほかの issue

mozilla/sccache の issue をすべて見る

似ている issue

Rust の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。