libstore: fix race condition when creating state directories#13368
Merged
edolstra merged 1 commit intoNixOS:masterfrom Jun 17, 2025
Merged
libstore: fix race condition when creating state directories#13368edolstra merged 1 commit intoNixOS:masterfrom
edolstra merged 1 commit intoNixOS:masterfrom
Conversation
Running parallel nix in nix can lead to multiple instances trying to create the state directories and failing on the `createSymlink` step, because the link already exists. `replaceSymlink` is already idempotent, so let's use that. Resolves NixOS#2706
1 task
edolstra
approved these changes
Jun 17, 2025
auto-merge was automatically disabled
June 17, 2025 08:53
Pull request was closed
lf-
pushed a commit
to lix-project/lix
that referenced
this pull request
Jun 26, 2025
Running (parallel?) nix in nix can lead to multiple instances trying to create the state directories and failing on the createSymlink step, because the link already exists. `replaceSymlink` is already idempotent, so let's use that. See also: - NixOS/nix#13368 - NixOS/nix#2706 Change-Id: I7fadd0ce3c1ffcebc9d281c00e5b49c12af3d50b
This was referenced Jul 30, 2025
mergify bot
added a commit
that referenced
this pull request
Jul 31, 2025
…3368 libstore: fix race condition when creating state directories (backport #13368)
mergify bot
added a commit
that referenced
this pull request
Jul 31, 2025
…3368 libstore: fix race condition when creating state directories (backport #13368)
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.
Running (parallel?) nix in nix can lead to multiple instances trying to create the state directories and failing on the
createSymlinkstep, because the link already exists.replaceSymlinkis already idempotent, so let's use that.Resolves #2706
I only see this race appearing in Nixpkgs' CI right now, for example https://github.com/NixOS/nixpkgs/actions/runs/15426171510/job/43413501065. It only happens very infrequently. I tried reproducing locally, by just running
nix-build ci -A nixpkgs-vetin a loop, but didn't succeed, so far. I'm running Lix locally, but that shouldn't make a difference, the relevant code is the same. I assume I can't reproduce, because I'd need to start from an empty cache, but I'm not sure.Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.