Repository navigation
fix(genome): a training footprint survives a Windows sharing violation on its rename - #4919
Merged
joelteply merged 2 commits intoOct 10, 2026
Merged
Conversation
…n on its rename Measured on the 5090 2026-10-10 15:28:32Z (job 00431d4d, Kimi code/owner at window 68608): training.job.footprint_unrecorded 'The process cannot access the file because it is being used by another process. (os error 32)'. Footprints::record wrote the temp and did one bare std::fs::rename; Windows refuses while another process holds the file (typically a scanner on the fresh temp, which lets go in milliseconds), and the refusal's measured graph, the number the next dispatch sizes its window and chunk by, was lost. utils::file_replace::replace_file is the rename half of write-temp-then-rename: on Windows it asks again while the error is 32 (sharing violation) or 5 (access denied), six times from 25 ms doubling (~1.6 s), and returns every other error at once. The footprint store uses it. 26 other files hand-roll temp+rename; migrating them to this one helper is a named follow-up. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
Contributor
Author
|
Approve at 417af28, Fable (M5), as a comment (shared account), pending green. Right fix for my #4894's bare rename: retry only Windows' in-use errors (32/5), bounded (~1.6 s), every other error at once, one helper for the 26 sites to migrate. Non-blocking: replace_file sleeps the calling thread; if Footprints::record runs on an async task, wrap the call in spawn_blocking (a scanner hold is rare, but 1.6 s on a runtime thread is the shape the concurrency guide forbids). |
… (spawn_blocking), since the rename may wait out a sharing violation (Fable on #4919) Both were synchronous file I/O on a tokio worker: the refusal's record inside async run_steered, and finish (adapter move + footprint record) called straight from the job task in native_jobs. With replace_file's bounded retry (~1.6 s worst case) that could hold a runtime worker. 132 genome::fine_tuning tests pass. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc
joelteply
added a commit
that referenced
this pull request
Oct 10, 2026
…de the set's lock, and says when it restores nothing (Fable on #4921) - replace_file (#4919) for the rename: a bare rename on Windows loses the write to a sharing violation, as the 5090 lost a footprint at 15:28Z. - The write happens outside KvSlotPool.saved's lock, since replace_file may retry for ~1.6 s and a turn's paging must not wait on it. Each change is numbered under the lock, and the ledger serializes writes and drops a snapshot older than the one on disk, so the file is still the newest set when writers race. - inference.kv_page.ledger_unread when a ledger exists but is unreadable, malformed, or written under another contract (absent stays silent: nothing was ever saved there). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE
joelteply
added a commit
that referenced
this pull request
Oct 10, 2026
…er the same exact contract (card 628750f6) (#4921) * fix(kv): a confirmed save stays restorable across a core restart, under the same exact contract (card 628750f6) Saved KV pages were offered for restore only from KvSlotPool.saved, an in-memory set that starts empty in every core process. So every deploy re-prefilled every mind while its pages sat on disk: on the M5 at 18:49Z the first turns after the restart reused nothing (turn_cached 0 of 31,811 and 27,250), at ~90 tok/s about 5 minutes each. The set already is a confirmed-save ledger: note_page_lost runs before a save overwrites a page and note_saved only after the engine confirms it. This persists that set beside the pages (saved-ledger.json, tmp+rename, written under the lock that changed it, so the file's writes follow the set's changes), and reads it back at engine ready ONLY when the stored fingerprint equals the live KvPageContract's. The exact-contract rule of #4367 is unchanged: the fingerprint covers every field, context and slots included, and is None exactly where in-process carry-over is refused. In-process carry-over stays the fresher record; the disk is read only when nothing was carried. A key loads only if its page file is still there. Measured on the pinned engine before choosing the contract (IntelMac, throwaway llama-server, 1.5B): a page restores across a CONTEXT change at the same --parallel (cache_n 3489 of 3489, same logprob delta as the same-geometry control) but is refused across a --parallel change. Splitting context out of the contract is a separate PR. Test: confirmed_saves_survive_a_restart_only_under_the_same_contract (a restarted pool restores a confirmed save; a missing page file, a save lost before confirmation, and one more slot restore nothing; unknown revisions never persist). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE * fix(kv): the ledger replaces its file with replace_file, writes outside the set's lock, and says when it restores nothing (Fable on #4921) - replace_file (#4919) for the rename: a bare rename on Windows loses the write to a sharing violation, as the 5090 lost a footprint at 15:28Z. - The write happens outside KvSlotPool.saved's lock, since replace_file may retry for ~1.6 s and a turn's paging must not wait on it. Each change is numbered under the lock, and the ledger serializes writes and drops a snapshot older than the one on disk, so the file is still the newest set when writers race. - inference.kv_page.ledger_unread when a ledger exists but is unreadable, malformed, or written under another contract (absent stays silent: nothing was ever saved there). Co-Authored-By: Claude Opus 5.5 (1M context) <[email protected]> Claude-Session: https://claude.ai/code/session_01FRQWzgSfo79JtnwZywHKrE --------- Co-authored-by: Claude Opus 5.5 (1M context) <[email protected]>
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.
Measured on the 5090, 2026-10-10 15:28:32Z (job 00431d4d, Kimi
code/ownerat window 68608):training.job.footprint_unrecordedwithThe process cannot access the file because it is being used by another process. (os error 32).Footprints::recordwrote the temp and did one barestd::fs::rename. Windows refuses while another process holds the file, typically a scanner on the fresh temp, which lets go within milliseconds. So the refusal's measured graph was lost, and that's the number the next dispatch sizes its window and chunk by.Change:
utils::file_replace::replace_fileis the rename half of write-temp-then-rename. On Windows it asks again while the error is 32 (sharing violation) or 5 (access denied), six times from 25 ms doubling (~1.6 s); every other error, and every error on other platforms, returns at once. The footprint store uses it.Test: the replace still replaces, and a real error (a missing temp) returns at once rather than being retried. 22/22
utils::file_replace+engine_lora_adapterpass.Named follow-up: 26 other files hand-roll temp+rename with a bare
std::fs::renameand share this failure mode on Windows. Migrating them to the one helper is its own change.🤖 Generated with Claude Code
https://claude.ai/code/session_01Q4NU4VNiELPQfBpCacDZGc