fix(search): survive the transient I/O abort (os 995) during a parked-drive re-warm#469
Merged
Merged
Conversation
…-drive re-warm A search landing while the daemon re-warms parked drives could fail with `Daemon search_cli failed → I/O error … (os error 995)`. 995 is `ERROR_OPERATION_ABORTED`: the OS cancels a *pending* overlapped read when the thread that issued it is reaped (tokio `spawn_blocking` / rayon worker recycling during the re-warm, whose USN-refresh reads MFT extents over the broker's overlapped handle). The read is valid — it just needs reissuing — but it propagated straight out as a hard search failure (retrying by hand worked). Two layers, root + safety net: 1. **Root (uffs-mft `read_handle_at`):** wrap the overlapped read in a bounded retry on `ERROR_OPERATION_ABORTED`. Every broker-handle read goes through this primitive, so the whole re-warm read path becomes abort-resilient. Split into a `read_handle_at` retry wrapper + `read_handle_at_once` attempt; `is_operation_aborted` classifies the 995. 2. **Safety net (uffs-cli `search_retry`):** a new module wraps `search_cli_raw` in `search_cli_with_warm_retry` — bounded retries with back-off when it sees the os-995 transient, printing "UFFS index is warming up — retrying…" on stderr (never stdout) instead of a raw I/O error. Catches the transient regardless of which read produced it; real errors still fail fast. Verified: macOS + windows-msvc builds, macOS + Windows clippy clean, and a `warming_abort_matches_only_995` unit test (retry only on 995, not real errors). Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
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.
Symptom
The first search after the daemon idle-parks drives can fail:
…and a manual retry then works (the re-warm finished in the background). Observed on Windows after ~3 h idle (7 drives, 26 M records): the search waited out the re-warm, then died at the end.
Root cause
os error 995 = ERROR_OPERATION_ABORTED— the OS cancels a pending overlapped read when the thread that issued it is reaped. During a parked-drive re-warm,DiskBodyLoader::load→load_drive_with_usn_refreshreads MFT extents over the broker'sFILE_FLAG_OVERLAPPEDhandle fromspawn_blocking/rayon workers that recycle; a pending read on a retiring thread gets aborted. The read is valid — it just needs reissuing — but it propagated out as a hard search failure.Fix — root + safety net
uffs-mftread_handle_at): bounded retry onERROR_OPERATION_ABORTED. Split into aread_handle_atretry wrapper +read_handle_at_oncesingle attempt, with anis_operation_abortedclassifier. Every broker-handle read flows through this primitive, so the whole re-warm read path becomes abort-resilient.uffs-clisearch_retry): new module —search_cli_with_warm_retryretries the search with back-off on the os-995 transient and prints "UFFS index is warming up — retrying…" to stderr (never stdout/CSV) instead of a raw error. Catches the transient regardless of origin; real errors still fail fast.Tests / verification
warming_abort_matches_only_995unit test: retry only on 995, not onos error 5/ConnectionClosed.x86_64-pc-windows-msvcbuilds, macOS + Windows clippy clean, full pre-push gate green.main.rswithin the 800-LOC policy.🤖 Generated with Claude Code