Repository navigation
fix: make concurrent first use of packages race-free - #647
Merged
Merged
Conversation
Concurrent first uses of Hermit packages failed intermittently on Linux CI with "unknown package" or "stat <cache archive>: no such file or directory". Manifest syncs were unserialised. Every process that missed a package forced a sync, and concurrent clones or failed pulls deleted and replaced the shared checkout while other processes read it. Syncs now take a per-source lock, skip if another process synced while they waited, and move the old checkout aside instead of deleting it. The first use of a channel package counted as an overdue update with an unknown ETag, so every process evicted the cached archive and unpacked package, then reinstalled them, while others were about to extract that archive. First uses now record the check, and upgrades download over the archive instead of evicting it and skip reinstalling a version another process already installed. Git package sources cloned straight into the cache, so concurrent processes copied partial checkouts. They now clone into a temporary directory and rename it into place. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The linter config doesn't flag exec.Command in tests, so nolintlint reported these directives as unused and failed the Lint check. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
A process that downloads a channel package outside the lock can find it already extracted by a process that used its download from the cache without knowing its ETag. Neither recorded the ETag, so the first channel check recorded an empty one, and its unlocked write could also overwrite a real one. A later check would then reinstall the package. The downloading process now records the ETag even when it didn't extract the package, and the first check records its state under the lock after reading it again. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
jvmakine
approved these changes
Nov 19, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Concurrent first uses of packages fail intermittently in bit's CI with
<pkg>: unknown packageorstat <cache archive>: no such file or directory. This fixes the three races behind them.In Linux Docker trials of 16 or 32 concurrent first uses, the original build failed up to 18 of 20 trials. The fixed build had no failures in 160 trials. Each race has a regression test that fails on the original code, including a multi-process integration test.
Co-Authored-By: Claude Opus 5.5 noreply@anthropic.com