Add an execution log differ that reports why spawns differ between two builds
Maintainers usually reply within 2 days
Nobody has claimed this yet.
Assessment
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Newbie friendliness
- 35/100
- Issue type
- Feature
- Clarity
- Mostly clear
- Activity status
- Active
- Tech stack
- java
- Domain
- build-system, devtools
Research direction
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.
Written by the indexing model from the issue text.
Description
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_differcompares command lines and input lists from twoaqueryoutputs. 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.
- Dominant language
- Java
- Stars
- 26.2k
- Forks
- 4.7k
- Avg merge
- 3d 11h
- Merged PRs (30d)
- 125
Getting set up
Starts the project's dev container in your browser, under your own GitHub account.
- No Dockerfile or Docker Compose file
- Has a pull request template
- Read the contributing guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from bazelbuild/bazel
-
team-Rules-Java type: bug untriaged
Difficulty 2/5 1-3 hours Newbie friendliness 83/100
bazelbuild/bazel#33068 ·
Maintainers usually reply within 2 days
-
Remote repo contents cache rejects repos with a backslash in a file name on UnixPossibly taken A pull request linked to this issue is open or already merged. Openteam-Remote-Exec type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bazelbuild/bazel#32601 · 3 comments · 1 assignee ·
Maintainers usually reply within 2 days
-
Difficulty 2/5 1-3 hours Newbie friendliness 74/100
bazelbuild/bazel#32132 ·
Maintainers usually reply within 2 days
-
team-Local-Exec type: documentation (cleanup)
Difficulty 2/5 1-3 hours Newbie friendliness 72/100
bazelbuild/bazel#31318 ·
Maintainers usually reply within 2 days
-
Docs: run/build.mdx describes a sandboxing warning removed in 2017 and a flag deleted in 9.0.0Possibly taken @lavishdev claimed this 70 days ago. Openhelp wanted P2 team-Documentation team-OSS type: bug
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
bazelbuild/bazel#31316 ·
Maintainers usually reply within 2 days
All issues in bazelbuild/bazel
Similar issues
-
Difficulty 2/5 1-3 hours Newbie friendliness 76/100
Lincoln-cn/JAiRouter#1473 ·
Maintainers usually reply within 1 day
-
Difficulty 1/5 Under an hour Newbie friendliness 88/100
exercism/java-analyzer#379 ·
-
area: ui bug priority: low
Difficulty 2/5 1-3 hours Newbie friendliness 66/100
tetsuji16/microProject#1893 ·
Maintainers usually reply within 1 day
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
liberation-data/fornax4j#325 ·
Maintainers usually reply within 1 day
-
[Bug]: FE and Kinesis extraction pipes render flow starting at the centre and scroll the source arm backwardsPossibly taken @chonkzillaofficial claimed this today. Open
Difficulty 2/5 1-3 hours Newbie friendliness 79/100
BCCE-team/BuildCraft#85 ·