Skip to content

Conversation

@fmeum
Copy link
Collaborator

@fmeum fmeum commented Oct 17, 2023

Ensure that BazelLockFileModule only updates MODULE.bazel.lock if the content of the file needs to change. Every such update changes the file's metadata, which results in Skyframe invalidation of, in particular, all configurations. This broke bazel config, which uses MemoizingEvaluator#getDoneValues() to directly observe Skyframe state.

Since this type of invalidation can also be caused by users and deviates from the usual "incremental correctness" guarantees provided by Bazel, let config show a descriptive error when no configurations are found.

Fixes #19823

@fmeum fmeum requested review from gregestren and meteorcloudy and removed request for Wyverald and meteorcloudy October 17, 2023 11:32
@github-actions github-actions bot added awaiting-review PR is awaiting review from an assigned reviewer team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. labels Oct 17, 2023
Copy link
Member

@meteorcloudy meteorcloudy left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for figuring this out!!

@meteorcloudy meteorcloudy added awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally and removed awaiting-review PR is awaiting review from an assigned reviewer labels Oct 17, 2023
@fmeum
Copy link
Collaborator Author

fmeum commented Oct 17, 2023

@meteorcloudy I flagged the original issue for Bazel 6.4.0 since I assume we want lockfiles to work well in 6.4.0 before we turn them on by default in 7.X.0. Do you agree?

@fmeum
Copy link
Collaborator Author

fmeum commented Oct 17, 2023

I had to update the test to allow networking.

@meteorcloudy
Copy link
Member

meteorcloudy commented Oct 17, 2023

To fix the test failure, you'll have to add write_default_lockfile $dir/main/MODULE.bazel.lock in test_external_repo_scope

@fmeum fmeum requested a review from meteorcloudy October 17, 2023 11:56
@meteorcloudy
Copy link
Member

Or enable internet access

@fmeum
Copy link
Collaborator Author

fmeum commented Oct 17, 2023

To fix the test failure, you'll have to add write_default_lockfile $dir/main/MODULE.bazel.lock in test_external_repo_scope

Nice, changed it to do that.

@meteorcloudy
Copy link
Member

I flagged the original issue for Bazel 6.4.0 since I assume we want lockfiles to work well in 6.4.0 before we turn them on by default in 7.X.0. Do you agree?

Ok, let's get this one in 6.4

Ensure that `BazelLockFileModule` only updates `MODULE.bazel.lock` if
the content of the file needs to change. Every such update changes the
file's metadata, which results in Skyframe invalidation of, in
particular, all configurations. This broke `bazel config`, which uses
`MemoizingEvaluator#getDoneValues()` to directly observe Skyframe state.

Since this type of invalidation can also be caused by users and deviates
from the usual "incremental correctness" guarantees provided by Bazel,
let `config` show a descriptive error when no configurations are found.
@fmeum fmeum requested a review from meteorcloudy October 17, 2023 12:07
@meteorcloudy
Copy link
Member

meteorcloudy commented Oct 17, 2023

I'm importing this one to accelerate the process.

Sent out to @gregestren @katre for review

@github-actions github-actions bot removed the awaiting-PR-merge PR has been approved by a reviewer and is ready to be merge internally label Oct 17, 2023
@fmeum fmeum deleted the 19823-fix-config branch October 17, 2023 14:25
fmeum added a commit to fmeum/bazel that referenced this pull request Oct 17, 2023
…update

Ensure that `BazelLockFileModule` only updates `MODULE.bazel.lock` if the content of the file needs to change. Every such update changes the file's metadata, which results in Skyframe invalidation of, in particular, all configurations. This broke `bazel config`, which uses `MemoizingEvaluator#getDoneValues()` to directly observe Skyframe state.

Compared to the original commit bazelbuild@78db9ae, this cherry-pick does not include the change to `bazel config` as it may not be backwards compatible (changes the exit code in certain situations).

Fixes bazelbuild#19823

Closes bazelbuild#19842.

PiperOrigin-RevId: 574133346
Change-Id: I5886c91fc6b7b938a7dee59ea75aa7b8afb5b161

Fixes bazelbuild#19843
iancha1992 pushed a commit that referenced this pull request Oct 17, 2023
#19848)

…update

Ensure that `BazelLockFileModule` only updates `MODULE.bazel.lock` if
the content of the file needs to change. Every such update changes the
file's metadata, which results in Skyframe invalidation of, in
particular, all configurations. This broke `bazel config`, which uses
`MemoizingEvaluator#getDoneValues()` to directly observe Skyframe state.

Compared to the original commit
78db9ae,
this cherry-pick does not include the change to `bazel config` as it may
not be backwards compatible (changes the exit code in certain
situations).

Fixes #19823

Closes #19842.

PiperOrigin-RevId: 574133346
Change-Id: I5886c91fc6b7b938a7dee59ea75aa7b8afb5b161

Fixes #19843
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

cquery's config function doesn't work with Bzlmod

2 participants