libstore: only acquire big write lock when needed, hold read lock#15967
Open
lisanna-dettwyler wants to merge 1 commit into
Open
libstore: only acquire big write lock when needed, hold read lock#15967lisanna-dettwyler wants to merge 1 commit into
lisanna-dettwyler wants to merge 1 commit into
Conversation
Contributor
Author
|
I might also be able to remove the |
edolstra
reviewed
Jun 5, 2026
19c62b4 to
b260647
Compare
Check if a schema migration is actually needed before acquiring exclusive on the big nix store lock, and always hold a shared lock throughout the duration of the LocalStore. Checking if it's needed prevents the build hook from trying to acquire exclusive while the parent is holding shared. Signed-off-by: Lisanna Dettwyler <lisanna.dettwyler@gmail.com>
b260647 to
6d8846a
Compare
xokdvium
reviewed
Jun 5, 2026
22ed4a8 to
41e2fab
Compare
Contributor
Author
|
Dropping the |
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.
Check if a schema migration is actually needed before acquiring exclusive on the big nix store lock, and always hold a shared lock throughout the duration of the LocalStore. Checking if it's needed prevents the build hook from trying to acquire exclusive while the parent is holding shared.
Motivation
We need to hold the shared lock throughout the lifetime of the LocalStore to prevent other schema upgrades from happening while we're using the store.
Context
Prior attempt to fix this logic: #15941
There are no schema migration tests that I know of, so this logic should be thoroughly examined before merging, although keeping in mind that the current state of affairs is already broken and can result in a hang.
Add 👍 to pull requests you find important.
The Nix maintainer team uses a GitHub project board to schedule and track reviews.