Skip to content

libexpr: Make lookupPathResolved thread-safe#15488

Merged
xokdvium merged 1 commit intomasterfrom
thread-safe-eval-state
Mar 26, 2026
Merged

libexpr: Make lookupPathResolved thread-safe#15488
xokdvium merged 1 commit intomasterfrom
thread-safe-eval-state

Conversation

@Mic92
Copy link
Copy Markdown
Member

@Mic92 Mic92 commented Mar 16, 2026

The lookupPathResolved cache was a plain unordered_flat_map with unsynchronized find()/emplace() calls in resolveLookupPathPath(). Multiple threads resolving lookup paths concurrently would race on this cache.

Replace it with a concurrent_flat_map following the same pattern used for srcToStore, importResolutionCache, and fileEvalCache.

Motivation

Context


Add 👍 to pull requests you find important.

The Nix maintainer team uses a GitHub project board to schedule and track reviews.

@Mic92 Mic92 requested a review from edolstra as a code owner March 16, 2026 10:29
@Mic92 Mic92 force-pushed the thread-safe-eval-state branch from a5ddee5 to 98fc0f7 Compare March 16, 2026 11:13
@Mic92
Copy link
Copy Markdown
Member Author

Mic92 commented Mar 16, 2026

ci might fail because of #15485

The lookupPathResolved cache was a plain unordered_flat_map with
unsynchronized find()/emplace() calls in resolveLookupPathPath().
Multiple threads resolving lookup paths concurrently would race on
this cache.

Replace it with a concurrent_flat_map following the same pattern used
for srcToStore, importResolutionCache, and fileEvalCache.
@Mic92 Mic92 force-pushed the thread-safe-eval-state branch from 98fc0f7 to 04516ac Compare March 24, 2026 13:49
@xokdvium xokdvium added this pull request to the merge queue Mar 26, 2026
Merged via the queue into master with commit 2540581 Mar 26, 2026
20 checks passed
@xokdvium xokdvium deleted the thread-safe-eval-state branch March 26, 2026 22:08
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.

2 participants