Skip to content

flaky: binary-index reload race in values_bound_type_after_delete_incremental_index_timeline under parallel grp_misc (dict branch: too small for header) #1489

Closed as not planned

Description

@aaj3f

Symptom

it_values_type_deleted_repro::values_bound_type_after_delete_incremental_index_timeline (bundled into fluree-db-api/tests/grp_misc.rs via #[path], source at fluree-db-api/tests/it_values_type_deleted_repro.rs:202) fails roughly 1 in 6 thread-parallel cargo test --test grp_misc runs with:

Internal("failed to load binary index: dict branch: too small for header")

It passes reliably single-threaded (--test-threads=1) and was not observed failing under nextest's process-per-test execution during the same gate batteries.

Shape of the failing timeline

The test drives the production-like background-indexer sequence: insert across two commits → build_and_publish_index → reload ledger → wipe → incremental build_and_publish_index folding the retractions → reload → re-insert → index → reload, asserting VALUES/type shapes agree at each step. The failure is on a reload step: the freshly published binary index's dict branch fails the header-size check when read back, which points at a reload race (reader observing a partially-written or stale dict-branch artifact) rather than anything in the test's own assertions — i.e. a fluree-db-core binary-index load/publish race surfaced by CPU contention, not a query bug.

Discovery context

Surfaced during the perf-series gate batteries (PR #1486 body records it as an explicitly out-of-scope, pre-existing flake — that PR only moves an unrelated test between binaries and touches no engine code). The failure rate was measured while grp_misc's ~240 bundled tests ran thread-parallel in one process, so timing pressure from sibling tests appears to be the trigger.

Suggested next steps for the binary-index owner

  • Reproduce with cargo test -p fluree-db-api --test grp_misc values_bound_type_after_delete_incremental_index_timeline looped under parallel sibling load (or the full grp_misc repeated ~10×).
  • Audit the publish→reload boundary in the binary-index dict-branch writer/loader for a missing ordering guarantee (rename-before-flush, non-atomic publish of the branch file, or a cached header length read against a superseded artifact).

Activity

  1. added
    bug
    on Jul 14, 2026
  2. aaj3f commented on Aug 25, 2026

    @aaj3f
    ContributorAuthor

    Sweep note (claude-assisted): I could not reproduce this at 47e96b7b6 — 25× thread-parallel grp_misc runs (262 tests each) on a deliberately loaded box, zero failures, against the filed ~1-in-6 rate (p≈0.01 that we'd see zero if the rate still held).

    The last occurrence I can find is the #1552 CI comment in early August, and the dict subsystem has been substantially reworked since (the #1622-era pack compaction, the #1624 rebuild chain, f266e6100) — a plausible incidental fix, though nothing in that lineage targets the publish→reload ordering this issue hypothesizes, so I don't want to declare victory on vibes.

    @bplatz, when you get a chance: if CI has been silent on dict branch: too small for header since ~8/11 (the dict-rework landings), I think we close this as fixed-incidentally with that citation; if it's recurred anywhere, the audit target from the body (the dict-branch writer/loader ordering at dict/branch.rs decode + its publish path) still stands and this stays open.

  3. added
    P2
    triage:needs-info
    area:storage
    on Aug 25, 2026
  4. bplatz commented on Nov 14, 2026

    @bplatz
    Contributor

    Closing because it hasn't come back. Two rounds of 25 parallel runs passed: the August round noted above, and one of the grp_misc binary on 2026-11-14 against main at f42ea37. No recurrence has been reported here since early August.

    Nothing has changed the suspected cause, though. If it reappears, start with the publish→reload ordering in dict/branch.rs, and with write_numbig_arena (numbig.rs:352), which uses a plain std::fs::write, so a reader racing the write can see a short file. Please reopen with the failing run.

  5. reopened this on Nov 14, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

P2area:storagebugtriage:needs-info

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions