Skip to content

Fix shared registry cache deadlocks - #100

Open
charliermarsh wants to merge 3 commits into
charlie/1.98/trust-mirrored-registry-packagesfrom
charlie/fix-shared-cache-locking
Open

charliermarsh wants to merge 3 commits into
charlie/1.98/trust-mirrored-registry-packagesfrom
charlie/fix-shared-cache-locking

Conversation

@charliermarsh

@charliermarsh charliermarsh commented Aug 30, 2026 •

Copy link
Copy Markdown
Collaborator

Concurrent cold worktrees can deadlock when each Cargo invocation holds a dependency's read lock while waiting for another dependency's write lock. We now acquire the complete shared-unit lock set in path order and restart preparation if it discovers another required writer.

On Linux and macOS, compiler, build-script, and rustdoc children retain the locks protecting their work. Nested builds use private artifacts, and nested cleanup must stay outside the parent's build and target trees. The cache namespace changes, so affected artifacts are rebuilt once.

The measured locking revision added 20–24 ms (6–9%) to unchanged Ruff and uv checks against equivalently built Ohm 1.98.0-3 sources. That measurement predates the final documentation and nested-cleanup fixes. Builds sharing a dirty dependency can still serialize; Windows/Solaris child lifetimes and post-build doctest/rustdoc-merge locking remain outside this repair.

@charliermarsh
charliermarsh marked this pull request as ready for review August 30, 2026 16:59
charliermarsh added a commit to astral-experiments/ohm that referenced this pull request Aug 30, 2026
Prepare Ohm 1.98.0 revision 4 with incremental Clippy diagnostics,
per-item visibility inputs, streamed well-formedness obligations, and
the shared registry cache deadlock repair. Pin the compiler stack
through [ohm-rust#75](astral-experiments/ohm-rust#75),
including [#72](astral-experiments/ohm-rust#72), the
Cargo stack through
[ohm-cargo#100](astral-experiments/ohm-cargo#100), and
the Clippy stack through
[ohm-rust-clippy#49](astral-experiments/ohm-rust-clippy#49).
Preserve the existing rustfmt pin and align the compiler's Cargo gitlink
with the manifest.

Add the versioned manifest, select it by default, update installation
examples, and refresh the upstream-change document. Clippy now caches 56
audited passes covering 62 lint kinds. The Cargo lock repair changes the
shared-cache namespace, so the first build repopulates affected
artifacts and unchanged builds may incur additional lock-preparation
overhead.

Keep the component PRs open for review in one GitHub stack per
repository. The unmeasured parallel query-cache promotion experiment in
ohm-rust#66 remains above the selected compiler pin and outside this
release. Preserve all historical manifests and published benchmark
results; the existing performance figures remain labeled as Ohm 1.98.0-3
measurements.
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from 28c2ed4 to 5e311b2 Compare September 6, 2026 20:33
@charliermarsh
charliermarsh changed the base branch from charlie/1.98/uv-cache-warm-metadata to charlie/1.98/uv-cache-miss-coalescing September 6, 2026 20:33
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from 5e311b2 to dbc58fd Compare September 8, 2026 21:02
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from dbc58fd to aef1a2f Compare September 16, 2026 16:39
@charliermarsh
charliermarsh removed this pull request from stack #125 October 1, 2026 15:21
@charliermarsh
charliermarsh changed the base branch from charlie/1.98/uv-cache-miss-coalescing to ohm-1.99.0 October 1, 2026 15:24
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from aef1a2f to 9194be4 Compare October 1, 2026 15:26
@charliermarsh
charliermarsh changed the base branch from ohm-1.99.0 to charlie/1.98/uv-cache-miss-coalescing October 1, 2026 15:28
@charliermarsh
charliermarsh added this pull request to stack #129 October 1, 2026 15:28
@charliermarsh
charliermarsh removed this pull request from stack #129 October 1, 2026 15:31
@charliermarsh
charliermarsh changed the base branch from charlie/1.98/uv-cache-miss-coalescing to ohm-1.99.0 October 1, 2026 15:33
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from 9194be4 to fc2a1d4 Compare October 1, 2026 15:35
@charliermarsh
charliermarsh changed the base branch from ohm-1.99.0 to charlie/1.98/uv-cache-miss-coalescing October 1, 2026 15:37
@charliermarsh
charliermarsh added this pull request to stack #130 October 1, 2026 15:38
@charliermarsh
charliermarsh removed this pull request from stack #130 October 1, 2026 15:40
@charliermarsh
charliermarsh changed the base branch from charlie/1.98/uv-cache-miss-coalescing to ohm-1.99.0 October 1, 2026 15:42
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from fc2a1d4 to 38dd030 Compare October 1, 2026 15:45
@charliermarsh
charliermarsh changed the base branch from ohm-1.99.0 to charlie/1.98/uv-cache-miss-coalescing October 1, 2026 15:47
@charliermarsh
charliermarsh added this pull request to stack #131 October 1, 2026 15:51
@charliermarsh
charliermarsh removed this pull request from stack #131 October 5, 2026 13:39
@charliermarsh
charliermarsh added this pull request to stack #135 October 5, 2026 13:39
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from 38dd030 to 0407ea6 Compare October 7, 2026 13:59
@charliermarsh
charliermarsh removed this pull request from stack #135 October 7, 2026 14:00
@charliermarsh
charliermarsh changed the base branch from charlie/1.98/uv-cache-miss-coalescing to charlie/1.98/trust-mirrored-registry-packages October 7, 2026 14:00
@charliermarsh
charliermarsh added this pull request to stack #136 October 7, 2026 14:00
@charliermarsh
charliermarsh removed this pull request from stack #162 October 17, 2026 00:10
@charliermarsh
charliermarsh added this pull request to stack #163 October 17, 2026 00:12
@charliermarsh
charliermarsh removed this pull request from stack #163 October 17, 2026 12:54
@charliermarsh
charliermarsh added this pull request to stack #166 October 17, 2026 12:54
@charliermarsh
charliermarsh removed this pull request from stack #166 October 23, 2026 16:31
@charliermarsh
charliermarsh added this pull request to stack #227 October 23, 2026 16:32
@charliermarsh
charliermarsh removed this pull request from stack #227 October 25, 2026 13:06
@charliermarsh
charliermarsh added this pull request to stack #241 October 25, 2026 13:06
@charliermarsh
charliermarsh removed this pull request from stack #241 October 27, 2026 02:57
@charliermarsh
charliermarsh added this pull request to stack #252 October 27, 2026 02:57
@charliermarsh
charliermarsh removed this pull request from stack #252 October 27, 2026 15:06
@charliermarsh
charliermarsh added this pull request to stack #255 October 27, 2026 15:06
@charliermarsh
charliermarsh removed this pull request from stack #255 October 27, 2026 21:36
@charliermarsh
charliermarsh added this pull request to stack #257 October 27, 2026 21:36
@charliermarsh
charliermarsh removed this pull request from stack #257 October 28, 2026 00:23
@charliermarsh
charliermarsh added this pull request to stack #259 October 28, 2026 00:23
@charliermarsh
charliermarsh removed this pull request from stack #259 October 28, 2026 17:21
@charliermarsh
charliermarsh added this pull request to stack #272 October 28, 2026 17:21
@charliermarsh
charliermarsh removed this pull request from stack #272 October 28, 2026 17:42
@charliermarsh
charliermarsh added this pull request to stack #273 October 28, 2026 17:42
@charliermarsh
charliermarsh removed this pull request from stack #273 October 29, 2026 04:52
@charliermarsh
charliermarsh added this pull request to stack #278 October 29, 2026 04:53
@charliermarsh
charliermarsh removed this pull request from stack #278 October 29, 2026 14:06
Concurrent cold builds can retain dependency read locks while waiting for
each other's write locks. Preflight shared units under a read lease, then
drop the prepared runner and retry with exclusive profile access whenever
shared artifacts need rebuilding. Keep warm workspace edits concurrent.

Pass close-only lock ownership to scheduled compiler and build-script
children so a surviving worker remains protected after Cargo exits. Keep
nested Cargo builds private and reject target aliases and destructive
nested cleans before acquiring locks or removing files.

Version the shared cache namespace and add regressions for conflicting
dependency orders, input generations, failures, cancellation, nested
builds, and inherited lock lifetime. Coalescing eligibility is unchanged.
Keep the profile read lease and reserve the shared unit set in canonical
path order. Use write leases only for units that need rebuilding, and
discard all locks and observations before reserving additional writers.
This lets unrelated shared writers and readers compile concurrently
without introducing lock upgrades or exposing changing dependencies.

Keep reserved modes fixed through the invocation and inherit their guards
in compiler workers. Reject aliases beneath the locked profile and
revalidate generated compiler search directories after reservation.

Add gated cold/warm and stale/warm overlap regressions in both launch
orders, with dependency pinning, artifact checks, and bounded cleanup.
Skip doctest units in shared writer preflight, and invalidate rustdoc
outputs before observing unit freshness. Preserve the parent workspace's
private-cache fallback when package verification and lockfile generation
construct temporary workspaces.

Reject nested cleanup of descendants as well as ancestors of the parent's
build and target trees, so cleanup cannot unlink an active parent's locks.

Add documentation regressions and extend the live nested-build fixture
with protected descendants and package-then-clean coverage.
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from 0407ea6 to 7211e03 Compare November 17, 2026 06:26
@charliermarsh
charliermarsh added this pull request to stack #542 November 17, 2026 06:29
@charliermarsh
charliermarsh force-pushed the charlie/fix-shared-cache-locking branch from 7211e03 to 7ef0acd Compare November 17, 2026 07:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant