[9.3.0] Report each top-level node to the progress receiver only once (https:… (#30918) …//github.com/bazelbuild/bazel/pull/30734) `ParallelEvaluator#doMutatingEvaluation` classifies the requested top-level keys with `addReverseDepAndCheckIfDone` and schedules them in the same loop. Scheduling starts concurrent evaluation, so a key the loop has not reached yet can be built as a dependency of an already scheduled one. When the loop does reach it, it observes `DONE` and hands it to `informProgressReceiverThatValueIsDone`, which reports it to the progress receiver a second time -- the first report having come from `SkyFunctionEnvironment#commitAndGetParents` when the node was actually built. Whether a given key takes that path is a race between the main thread and the evaluator threads, so the double report is intermittent. This is not confined to tests. `SkyframeBuildView.ActionLookupValueProgressReceiver#evaluated` counts every call whose state is `SUCCESS_VERSION_CHANGED`, and the second report qualifies: a node built by this evaluation has a value version equal to the graph version, so `informProgressReceiverThatValueIsDone` computes `changed = true`. The `configuredObjectCount` and `configuredTargetCount` behind `AnalysisPhaseCompleteEvent` -- the "N targets configured" line and the corresponding BEP metrics -- are inflated by one for every top-level target that is also a dependency of another top-level target and happens to be built first. The fix records which keys were already done before anything is scheduled, so the loop can tell "was done when this evaluation began" from "became done while this loop was running". Only the former is reported, which is what the notification exists for; the latter has already been reported by `commitAndGetParents`. Fixes over-reporting of configured target counts, and fixes a flaky test. `//src/test/java/com/google/devtools/build/lib/analysis/test:TrimTestConfigurationTest` fails on unmodified master roughly two thirds of the time locally (9/15 at `e3c6211224`, 10/15 at `39055fdcc1`), always in `flagOffDifferentTestOptions_ResultsInDifferentCTs`: ``` IllegalStateException: Number of newly evaluated action lookup values 41 does not agree with number that changed in graph: 43 ``` That test requests `//test:native_shared_dep` and `//test:starlark_shared_dep` as top-level targets and they are also dependencies of earlier top-level targets in the same request, which is exactly the shape above. Instrumenting the receiver showed those two keys, and only those two, reported twice, with the second report coming from `informProgressReceiverThatValueIsDone` on the main thread. Across runs, the number of second reports was 0 in every passing run and 2 in every failing one. With this change the test passes 20/20. No - [x] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). RELNOTES: None Closes #30734. PiperOrigin-RevId: 967655660 Change-Id: Ib5faaf98fe7f325ab0fbf8b12735456dbf361a90 <!-- Thank you for contributing to Bazel! Please read the contribution guidelines: https://bazel.build/contribute --> ### Description <!-- Please provide a brief summary of the changes in this PR. --> ### Motivation <!-- Why is this change important? Does it fix a specific bug or add a new feature? If this PR fixes an existing issue, please link it here (e.g. "Fixes #1234"). --> ### Build API Changes <!-- Does this PR affect the Build API? (e.g. Starlark API, providers, command-line flags, native rules) If yes, please answer the following: 1. Has this been discussed in a design doc or issue? (Please link it) 2. Is the change backward compatible? 3. If it's a breaking change, what is the migration plan? --> No ### Checklist - [ ] I have added tests for the new use cases (if any). - [ ] I have updated the documentation (if applicable). ### Release Notes <!-- If this is a new feature, please add 'RELNOTES[NEW]: <description>' here. If this is a breaking change, please add 'RELNOTES[INC]: <reason>' here. If this change should be mentioned in release notes, please add 'RELNOTES: <reason>' here. --> RELNOTES: None Commit https://github.com/bazelbuild/bazel/commit/032b4bc20e1c58f66ee90cc0f94205b95346520f Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
{Fast, Correct} - Choose two
Build and test software of any size, quickly and reliably.
Speed up your builds and tests: Bazel rebuilds only what is necessary. With advanced local and distributed caching, optimized dependency analysis and parallel execution, you get fast and incremental builds.
One tool, multiple languages: Build and test Java, C++, Android, iOS, Go, and a wide variety of other language platforms. Bazel runs on Windows, macOS, and Linux.
Scalable: Bazel helps you scale your organization, codebase, and continuous integration solution. It handles codebases of any size, in multiple repositories or a huge monorepo.
Extensible to your needs: Easily add support for new languages and platforms with Bazel's familiar extension language. Share and re-use language rules written by the growing Bazel community.
Follow our tutorials:
To report a security issue, please email security@bazel.build with a description of the issue, the steps you took to create the issue, affected versions, and, if known, mitigations for the issue. Our vulnerability management team will respond within 3 working days of your email. If the issue is confirmed as a vulnerability, we will open a Security Advisory. This project follows a 90 day disclosure timeline.
See CONTRIBUTING.md