Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: buggy lock-free fast-path check #390

Merged
merged 1 commit into from Nov 14, 2023
Merged

Conversation

alecthomas
Copy link
Collaborator

@alecthomas alecthomas commented Nov 14, 2023

The fast-path check to short-circuit locking was buggy becaues it was statting the Package.Binaries slice without glob expansion. That is, it ended up statting globs like bin/*, resulting in frequent unnecessary locking.

The fast-path check to short-circuit locking was buggy becaues it was
statting the `Package.Binaries` slice without glob expansion. That is,
it ended up statting globs like `bin/*`.
@alecthomas alecthomas merged commit 44cb709 into master Nov 14, 2023
6 checks passed
@alecthomas alecthomas deleted the aat/fix-unnecessary-lock branch November 14, 2023 23:59
alecthomas added a commit that referenced this pull request Nov 15, 2023
We use double-checked locking to avoid locks on the fast-path, but I
modified the behaviour in #390 to cache the result before the lock,
removing the second check. Face palm.

This fixes #391
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.

None yet

2 participants