Skip to content

[8.8.0] Fix cycles when checking the local repo contents cache#29087

Closed
fmeum wants to merge 1 commit into
bazelbuild:release-8.8.0from
fmeum:rrcc-8.7.0-21
Closed

[8.8.0] Fix cycles when checking the local repo contents cache#29087
fmeum wants to merge 1 commit into
bazelbuild:release-8.8.0from
fmeum:rrcc-8.7.0-21

Conversation

@fmeum

@fmeum fmeum commented Mar 24, 2026

Copy link
Copy Markdown
Collaborator

Fixes #27517 by checking Skyframe deps in batches that stop right before any dep that may cause a cycle if checked while previous deps are out-of-date.

This is accompanied by a restructuring of RepoRecordedInput that consolidates all Skyframe logic associated with the computation of the corresponding value exclusively within that class. This will also be helpful in adding support for dynamic inputs to the remote repo contents cache in future work.

8.x adaptation: the upstream commit additionally moved the entirety of RepositoryFetchFunction to Skyframe workers so that checking the up-to-dateness of local repo contents cache entries isn't quadratic. That worker refactor is omitted in this backport: v9 merged RepositoryDelegatorFunction and StarlarkRepositoryFunction into a single worker-based RepositoryFetchFunction, which 8.x does not have. This backport keeps 8.x's split, restart-based architecture and applies only the cycle fix and the RepoRecordedInput restructuring on that model. The batched up-to-dateness check is restart-safe (isAnyValueOutdated short-circuits while its batch's values are still missing, and the caller restarts via env.valuesMissing()). The RepoRecordedInput API is otherwise ported faithfully so that the dynamic-inputs follow-up (#27634) can be cherry-picked later.

Depends on the repo-env handling port (#29069), whose commits are included in this branch.

Closes #28206.

Co-authored-by: Xudong Yang wyverald@gmail.com
PiperOrigin-RevId: 855252657
Change-Id: Ica18760ae79da5155fc0f3d8cd4f24c52a034c86
(cherry picked from commit 72a25a9)

@github-actions

Copy link
Copy Markdown

Thank you for contributing to the Bazel repository! This pull request has been marked as stale since it has not had any activity in the last 30 days. It will be closed in the next 30 days unless any other activity occurs. If you think this PR is still relevant and should stay open, please post any comment here and the PR will no longer be marked as stale.

@github-actions github-actions Bot added the stale Issues or PRs that are stale (no activity for 30 days) label Apr 27, 2026
@iancha1992 iancha1992 added soft-release-blocker Soft release blockers that are nice to have, but shouldn't block the release if it's the last one. and removed stale Issues or PRs that are stale (no activity for 30 days) labels Apr 27, 2026
@iancha1992 iancha1992 changed the title [8.7.0] 21/23: Fix cycles when checking the local repo contents cache [8.8.0] 21/23: Fix cycles when checking the local repo contents cache May 7, 2026
@iancha1992 iancha1992 changed the base branch from release-8.7.0 to release-8.8.0 May 7, 2026 18:08
@github-actions

github-actions Bot commented Jun 7, 2026

Copy link
Copy Markdown

Thank you for contributing to the Bazel repository! This pull request has been marked as stale since it has not had any activity in the last 30 days. It will be closed in the next 30 days unless any other activity occurs. If you think this PR is still relevant and should stay open, please post any comment here and the PR will no longer be marked as stale.

@github-actions github-actions Bot added the stale Issues or PRs that are stale (no activity for 30 days) label Jun 7, 2026
@fmeum fmeum changed the title [8.8.0] 21/23: Fix cycles when checking the local repo contents cache [8.8.0] Fix cycles when checking the local repo contents cache Jun 23, 2026
@github-actions github-actions Bot removed the stale Issues or PRs that are stale (no activity for 30 days) label Jun 24, 2026
@fmeum fmeum marked this pull request as ready for review June 24, 2026 07:53
@fmeum fmeum requested a review from a team as a code owner June 24, 2026 07:53
@github-actions github-actions Bot added team-Configurability platforms, toolchains, cquery, select(), config transitions team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file. team-Core Skyframe, bazel query, BEP, options parsing, bazelrc area-Bzlmod Bzlmod-specific PRs, issues, and feature requests awaiting-review PR is awaiting review from an assigned reviewer labels Jun 24, 2026
@iancha1992 iancha1992 enabled auto-merge June 24, 2026 18:52
@Wyverald

Copy link
Copy Markdown
Member

Do I understand correctly that checking the up-to-dateness of local repo contents cache entries is indeed quadratic, but still okay-ish in practice because Skyframe caches things?

Fixes bazelbuild#27517 by checking Skyframe deps in batches that stop right before any dep that may cause a cycle if checked while previous deps are out-of-date.

This is accompanied by a restructuring of `RepoRecordedInput` that consolidates all Skyframe logic associated with the computation of the corresponding value exclusively within that class. This will also be helpful in adding support for dynamic inputs to the remote repo contents cache in future work.

The upstream commit additionally moved the entirety of `RepositoryFetchFunction` to Skyframe workers so that checking the up-to-dateness of local repo contents cache entries isn't quadratic. That worker refactor is omitted in this 8.x backport, which keeps the existing split `RepositoryDelegatorFunction`/`StarlarkRepositoryFunction` architecture and restart-based evaluation; the cycle fix and the `RepoRecordedInput` restructuring are applied on that model. The batched up-to-dateness check is restart-safe (`isAnyValueOutdated` short-circuits while its batch's values are still missing).

Closes bazelbuild#28206.

Co-authored-by: Xudong Yang <wyverald@gmail.com>
PiperOrigin-RevId: 855252657
Change-Id: Ica18760ae79da5155fc0f3d8cd4f24c52a034c86
(cherry picked from commit 72a25a9)
auto-merge was automatically disabled June 25, 2026 07:40

Head branch was pushed to by a user without write access

@fmeum

fmeum commented Jun 25, 2026

Copy link
Copy Markdown
Collaborator Author

Do I understand correctly that checking the up-to-dateness of local repo contents cache entries is indeed quadratic, but still okay-ish in practice because Skyframe caches things?

Yes, that's what I would assume. The marker file is reread every time, which is something we could cache if it shows up as relevant overhead.

@fmeum

fmeum commented Jun 26, 2026

Copy link
Copy Markdown
Collaborator Author

Merged in 023a3f6

@fmeum fmeum closed this Jun 26, 2026
@github-actions github-actions Bot removed the awaiting-review PR is awaiting review from an assigned reviewer label Jun 26, 2026
@fmeum fmeum deleted the rrcc-8.7.0-21 branch June 26, 2026 11:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area-Bzlmod Bzlmod-specific PRs, issues, and feature requests soft-release-blocker Soft release blockers that are nice to have, but shouldn't block the release if it's the last one. team-Configurability platforms, toolchains, cquery, select(), config transitions team-Core Skyframe, bazel query, BEP, options parsing, bazelrc team-ExternalDeps External dependency handling, remote repositiories, WORKSPACE file.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants