Skip to content

Flaky: the_reconciler_resumes_a_dead_manifest_restore_with_its_spool_host loses its 100 ms claim window on a loaded runner #995

Closed

Description

@LeeroyHannigan

backup::tests::the_reconciler_resumes_a_dead_manifest_restore_with_its_spool_host in crates/engine/src/backup/tests.rs fails some CI runs:

panicked at crates/engine/src/backup/tests.rs:16396:5:
assertion `left == right` failed
  left: []
 right: [(1, 0, true, 2)]

Run that failed:

Cause

The test builds runtime2 with job_settings(), which gives each job a heartbeat period of 50 ms in the settings. A resumed job must see its claim confirmed within two periods, 100 ms, before its first download. The job reads that confirmation in crates/engine/src/backup/restore/download.rs line 134 and heartbeat.rs lines 336 to 340. The window starts when claim_restore_dead returns inside the reconciler cycle (reconciler.rs line 991).

Before that first read, the cycle does three more catalog reads and lists the spool, then spawns the job. The test then runs its assertions and the 5 ms sleep of wait_for_jobs. Then the job reads the manifest, removes the stale spool entry and sets up its spool. The first beat comes 50 ms after the job starts, and only when the job yields. When that work takes more than 100 ms, the job stops with ClaimLost ("no heartbeat confirmed the claim recently enough to download data/000002.json.gz"). It leaves the record RUNNING and loads nothing, so bulk_load_files() is empty at line 16396.

The stop itself is the intended behaviour. a_resumes_first_beat_is_the_takeovers_return (line 18651) asserts it when the test holds the read after the takeover for three periods. Production runs a 15 s period, a 30 s window.

Measured on this host at 95425f5

  • The test alone, 200 runs: 0 failures.
  • The backup::tests module, 20 runs: the test never failed. One run made during a build in the same lane failed three other spooled tests the same way. In each, a job stopped before its first download: a_resume_downloads_the_spool_files_a_crash_left_unverified, an_s3_restore_spools_every_file_and_removes_its_entry_at_the_end and a_resume_that_fails_before_it_runs_removes_this_hosts_spool_entry.
  • With a 150 ms std::thread::sleep after the second cycle_on (line 16377): 10 failures in 10 runs, with the CI panic and the stop line above.

Proposed fix

Build runtime2 (line 16343) with a heartbeat of 1 s, as a_file_replaced_between_the_two_passes_fails_in_the_load (line 18072) does for the same reason. With that change, the test passed 200 runs alone and 20 runs with the 150 ms sleep. No module run in 20 failed.

A 1 s heartbeat in spooled_runtime (line 14628) would cover all 22 spooled tests, including the three above. a_job_that_learnt_the_record_is_anothers_leaves_its_spool_entry (line 17437) waits for a beat, so it would take up to 1 s longer. That variant was not run.

Activity

  1. LeeroyHannigan commented on Nov 19, 2026

    @LeeroyHannigan
    CollaboratorAuthor

    Another spooled test failed the same way in CI: backup::tests::a_marker_naming_another_digest_has_its_file_downloaded_again. It ran on #526 at c38b722, a commit that changes only docs/manuals/07-upgrade-manual.md on top of 017335d, where the same job passed. It failed in run 44618952049, attempt 1, job mongodb-rust, at 2026-11-19 21:47 UTC, with 876 other engine lib tests passing:

    panicked at crates/engine/src/backup/tests.rs:17879:5:
    assertion `left == right` failed
      left: []
     right: [{"Artist": S("artist-00000"), "SongTitle": S("title-00000"), "Year": N("1999")}, ...]
    

    The test builds its runtime2 with spooled_runtime (line 14609 at that head), so the 1 s heartbeat proposed above for spooled_runtime covers it. In this run the job got as far as the GET of data/000001.json.gz, because the assertion before line 17879 passed, and then it loaded nothing. A lost heartbeat stops a job at that point with ClaimLost (restore/download.rs lines 143 and 187, restore/load.rs lines 185 and 245). The test output has no stop line, so this run does not confirm the reason.

  2. added a commit that references this issue on Nov 23, 2026
    2ef5613
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions