Add an execution log differ that reports why spawns differ between two builds

Aperta
#33,147 1 commento 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 2 giorni

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
4/5
Tempo stimato
3-5 giorni
Idoneità per principianti
35/100
Tipo di issue
Funzionalità
Chiarezza
Abbastanza chiara
Stato di attività
Attiva
Stack tecnologico
java

Direzione di ricerca

Start by reading src/tools/execlog:parser and the documented execution log comparison procedure linked in the issue. The proposal describes matching spawns and tracing changed inputs through the spawn graph, but the implementation is not included in the issue, and the author says it is about 1,000 lines of Java plus unit tests. Done means a tool in src/tools/execlog that compares compact logs and reports root causes with affected spawn counts.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

team-Performance team-Remote-Exec type: feature request untriaged
Description of the feature request:

Add a tool next to //src/tools/execlog:parser that compares two compact execution logs of the same build and reports why spawns differ, grouped by root cause.

One changed env var or source file makes every downstream spawn differ. The tool reports only the differences that aren't a consequence of another spawn, with the number of spawns each one affects. Output for two builds of a six-genrule workspace, where I edited a.txt between the builds and one genrule writes $RANDOM:

Spawns: 6 before, 6 after
Matched: 1 identical, 5 different
Unmatched: 0 only before, 0 only after

Causes, by the number of matched spawns that differ because of them:

1. file: a.txt
   3 spawns taking 0.056s, first: Genrule bazel-out/darwin_arm64-fastbuild/bin/a.out [//:a]

2. nondeterministic spawn: Genrule bazel-out/darwin_arm64-fastbuild/bin/stamp.out [//:stamp]
   2 spawns taking 0.037s, first: Genrule bazel-out/darwin_arm64-fastbuild/bin/stamp.out [//:stamp]

It detects changed arguments, env vars, platform properties and timeouts, added or removed inputs, changed files that no spawn in the log produces, and spawns that produce different outputs from the same command and inputs.

I have an implementation with unit tests and can send a PR if this is welcome in the tree.

Which category does this issue belong to?

Remote Execution

What underlying problem are you trying to solve with this feature?

Debugging cache misses between two builds.

The documented procedure is to build the parser from source, convert both logs to text and diff them. On a large build that diff is mostly consequences: the one difference that matters is repeated in every spawn downstream of it, and a nondeterministic action looks the same as one whose inputs changed.

--verbose_explanations became a no-op in ec10da4e3fad, whose description points to the execution log as the better way to pinpoint why an action was re-run. I couldn't find tooling on top of the log that does this.

Which operating system are you running Bazel on?

macOS

What is the output of bazel info release?

release 9.3.3

If bazel info release returns development version or (@non-git), tell us how you built Bazel.

No response

What's the output of git remote get-url origin; git rev-parse HEAD ?

Have you found anything relevant by searching the web?
  • scripts/aquery_differ compares command lines and input lists from two aquery outputs. It has no digests or outputs, so it can't see changed file contents or nondeterminism.
  • #24071 is about noise in the textual diff of two parsed logs.
  • #7962 and #32027 hash targets to tell that something changed, not why.
Any other information, logs, or outputs that you want to share?

Implementation notes:

  • It reads the compact format directly and keeps input sets nested. Sets are compared by a hash computed while reading and only flattened for spawns whose set of input paths changed.
  • Spawns are matched by mnemonic and first output.
  • A changed input is attributed to the spawn that produced it, through symlink actions and output directories, so causes propagate along the spawn graph.

Limits: compact format only, text output only, and builds with different output directories don't match up.

Is src/tools/execlog the right place for this? I could follow up with JSON output and a non-zero exit code on nondeterminism for use in CI.

The implementation is about 1,000 lines of Java plus unit tests, all under src/tools/execlog with no changes to Bazel itself; comparing two logs of a 966-spawn build of //src/tools/execlog:parser takes 0.7 s and peaks at 250 MB.

Lingua principale
Java
Stelle
26.2k
Fork
4.7k
Merge medio
3g 11h
PR unite (30g)
125

Preparare l'ambiente

Apri in Codespaces

Avvia il container di sviluppo del progetto nel browser, con il tuo account GitHub.

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di bazelbuild/bazel

Tutte le issue di bazelbuild/bazel

Issue simili

Altre issue su Java

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.