-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Prevent action conflicts for exec-starlark-exec transitions #13915
Conversation
fb08d22
to
051f6a3
Compare
051f6a3
to
a289108
Compare
@sdtwigg is reviewing this. |
Continuing the conversation at #13464 to clarify approaches. |
To clarify, I/we have not forgotten about this. There are just a lot of potential concerns (mostly with where to take this API in the future) that we want to address before proceeding. |
@sdtwigg Do you think that we'll be able to get some version of this (possibly without the |
050e005
to
81f5080
Compare
With this commit, an execution transition will recompute the transition hash appended to the output directory name if set by any previous Starlark transition. This also takes into account that the Starlark transition may transitively affect an option --foo_bar after the exec transition if it previously affected the corresponding host option --host_foo_bar. Previously, an execution transition would reuse the existing hash, which no longer reflected the current state of native options correctly and thus led to action conflicts. Fixes bazelbuild#13464.
81f5080
to
01cbfce
Compare
@gregestren I'm seeing unexpected NullPointerExceptions in the tests: https://storage.googleapis.com/bazel-untrusted-buildkite-artifacts/36b11777-1957-4dc8-9914-3bdd82aa6e4a/src%5Ctest%5Cjava%5Ccom%5Cgoogle%5Cdevtools%5Cbuild%5Clib%5Crules%5Ccpp%5CCcLibraryConfiguredTargetTest%5Cattempt_1.log. |
I'm not sure. Which line is |
This one: bazel/src/main/java/com/google/devtools/build/lib/analysis/starlark/FunctionTransitionUtil.java Line 442 in 01cbfce
|
I'm not sure why the tests get More broadly, can we pause this while we work out #13464 (comment) and the discussion at #13587 (comment)? The right next steps, in my mind, are for @sdtwigg and I to seed a proper design doc for all of us to focus our thoughts on. I want to be careful not to eliminate action conflicts by an endless layer of ad hoc changes. |
Sounds very good to me, the proposal seems very reasonable and would resolve a cluster of usability and performance issues around transitions, beyond action conflicts. Let me know when you have started a draft of the design doc and I will see what I can contribute. Should I close the current PR in favor of this effort? |
Ok, I was originally confused by the part of the this change (and corresponding discussion) regarding transitioning on I need to find a proper issue to post the longer-form summary of our plan around ST-hash computation; however, for this specific sub-issue, I was planning to fix this issue by moving transitionDirectoryNameFragment out of BuildOptions and into BuildConfigurationValue (previously called BuildConfiguration).
This essentially makes this PR irrelevant (although considering it did expose other potential performance problems with the the execution transition). |
See #14023 (comment) |
I fully agree that moving the |
…nValue As per discussion in b/203470434, transitionDirectoryNameFragment should completely depend on the current values of the (rest of) the BuildOptions class. Thus, it is far better to have this always computed from BuildOptions when building a BuildConfigurationValue than rely on users keeping it consistent. (Other results of BuildConfigurationValue itself are themselves wholly computed from BuildOptions so placement there is a natural fit.) This naturally fixes the exec transition forgetting to update transitionDirectoryNameFragment. This fixes and subsumes #13464 and #13915, respectively. This is related to #14023 PiperOrigin-RevId: 407913175
@sdtwigg Should I create a new PR containing just the test (probably only the one without |
…nValue As per discussion in b/203470434, transitionDirectoryNameFragment should completely depend on the current values of the (rest of) the BuildOptions class. Thus, it is far better to have this always computed from BuildOptions when building a BuildConfigurationValue than rely on users keeping it consistent. (Other results of BuildConfigurationValue itself are themselves wholly computed from BuildOptions so placement there is a natural fit.) This naturally fixes the exec transition forgetting to update transitionDirectoryNameFragment. This fixes and subsumes bazelbuild#13464 and bazelbuild#13915, respectively. This is related to bazelbuild#14023 PiperOrigin-RevId: 407913175
* Move transitionDirectoryNameFragment calculation to BuildConfigurationValue As per discussion in b/203470434, transitionDirectoryNameFragment should completely depend on the current values of the (rest of) the BuildOptions class. Thus, it is far better to have this always computed from BuildOptions when building a BuildConfigurationValue than rely on users keeping it consistent. (Other results of BuildConfigurationValue itself are themselves wholly computed from BuildOptions so placement there is a natural fit.) This naturally fixes the exec transition forgetting to update transitionDirectoryNameFragment. This fixes and subsumes #13464 and #13915, respectively. This is related to #14023 PiperOrigin-RevId: 407913175 * Properly account for StarlarkOptions at their default (=null) when calculating ST-hash Previously, the hash calculation was skipping including StarlarkOptions that happened to be at their default values. This is wrong since those values may still be in "affected by Starlark transition" (because either the commandline set them and the Starlark transition reset them to their Starlark defaults thus still requiring a hash change OR the commandline did not set them but a series of Starlark transitions did an default->B->default anyways causing the Starlark option to still be 'stuck' in "affected by Starlark transition"). Resolves #14239 PiperOrigin-RevId: 408701552 Co-authored-by: twigg <[email protected]>
With this commit, an execution transition will recompute the transition
hash appended to the output directory name if set by any previous
Starlark transition. This also takes into account that the Starlark
transition may transitively affect an option --foo_bar after the exec
transition if it previously affected the corresponding host option
--host_foo_bar.
Previously, an execution transition would reuse the existing hash, which
no longer reflected the current state of native options correctly and
thus led to action conflicts.
Fixes #13464.