Repository navigation
fix(index): avoid fragment reuse cache deadlock - #54
Merged
Merged
Conversation
## Summary - use the fragment-reuse metadata already loaded before entering the cache loader - prevent the loader from recursively probing its own single-flight cache key - add a zero-capacity Moka cache regression test for the eviction fallback ## Root cause `open_frag_reuse_index` loaded the matching metadata, then its cache-miss loader called `load_index` for the same UUID. `load_index` delegates to `load_indices`, which probes the same fragment-reuse cache key. Under eviction pressure, the single-flight leader therefore waited on its own in-flight load indefinitely. ## Validation - `cargo test -p lance test_open_frag_reuse_index_with_zero_capacity_cache -- --nocapture` - `cargo test -p lance test_load_indices -- --nocapture` - `cargo fmt --all` - `cargo clippy --all --tests --benches -- -D warnings` Fixes lance-format#8619 <!-- lance-gatekeeper-fix:v1 agent=04eb7f91260e98b8eaa60312dbe80b06 generation=1 --> Co-authored-by: Gatefixer <312823363+lance-gatefixer[bot]@users.noreply.github.com> (cherry picked from commit ff4584f)
andrea-reale
approved these changes
Aug 27, 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.
Related
ff4584f6c4811b0487701b61468d5a1b49e30cb7, applied unchanged. Upstream landed it onmainand did not backport it torelease/v10.0.release-8.0.0. That commit is not being ported: upstream's version carries a better regression test, and taking theirs keeps this file identical to upstream.What
open_frag_reuse_indexloads the fragment-reuse index metadata, then its cache-miss loader callsload_indexfor the same UUID.load_indexdelegates toload_indices, which probes the samefrag_reuse/{uuid}cache key. moka holds the waiter's write lock across the init future, so the inner call parks on a read against the outer write guard: a permanent, zero-CPU deadlock.It needs cache pressure to reach, since a cached entry never runs the loader — which is why it survives normal use and strikes when the index cache is small or under eviction. The fix uses the metadata already loaded before entering the cache loader, instead of re-reading it.
This is live on v10.0.0.
Testing
cargo test -p lance --lib test_open_frag_reuse_index_with_zero_capacity_cachepasses.Upstream's test provisions a
SessionwithMokaCacheBackend::no_cache(), so the loader always runs, and wraps the call in a 5s timeout. Confirmed it is not vacuous: reverting the two production lines makes it fail withcargo clippy -p lance --lib -- -D warningsandcargo fmt --checkclean.Compatibility
No API or format change. Removes a hang; nothing that previously succeeded behaves differently.