Pipeline library: cut writes leave unique staging files that are never removed (follow-up to #1660) #2494

Open
opened 2026-11-25 14:50:09 +00:00 by Makto94 · 2 comments
Makto94 commented 2026-11-25 14:50:09 +00:00 (Migrated from github.com)
Contributor

Imported from Marvisak/VIctory. Originally posted by Makto94 on 2026-11-25T14:50:09Z.


Since #1660, write_atomically() stages each write in <file>.tmp-<pid>-<n>. Before, the fixed host-pipelines.tmp was overwritten by the next save.

A write can still be cut:

  • save(true) returns early when added == 0 && !USED_CHANGED without waiting for a worker's save that is writing. end() then calls TerminateProcess, and nothing stops the victory-pipelines-N workers.
  • WRITING is per file, so even a waiting save(true) can let the worker's second write (early-pipelines.txt) start and be cut.
  • host_gpu_failed and crash exits call TerminateProcess directly.

Each cut write now leaves a staging file that no later run reuses, and nothing sweeps the cache folder. The target file stays whole.

A port of #1660 elsewhere fixed this in two small commits: one lock held across the whole of save(), taken before the early return; and a sweep of stale host-pipelines.bin.tmp-<digits>-<digits> / early-pipelines.txt.tmp-<digits>-<digits> regular files in use_pipeline_cache(), immediately for the own pid and after 10 minutes for other pids, because the cache folder is shared and there is no single-instance guard. Reference: https://github.com/LaunchDoesntCode/VI-Port/pull/174

<!-- greyfinch-sync:Marvisak/VIctory:issue:6607203724 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2496). Originally posted by [Makto94](https://github.com/Makto94) on 2026-11-25T14:50:09Z. --- Since #1660, `write_atomically()` stages each write in `<file>.tmp-<pid>-<n>`. Before, the fixed `host-pipelines.tmp` was overwritten by the next save. A write can still be cut: - `save(true)` returns early when `added == 0 && !USED_CHANGED` without waiting for a worker's save that is writing. `end()` then calls `TerminateProcess`, and nothing stops the `victory-pipelines-N` workers. - `WRITING` is per file, so even a waiting `save(true)` can let the worker's second write (`early-pipelines.txt`) start and be cut. - `host_gpu_failed` and crash exits call `TerminateProcess` directly. Each cut write now leaves a staging file that no later run reuses, and nothing sweeps the cache folder. The target file stays whole. A port of #1660 elsewhere fixed this in two small commits: one lock held across the whole of `save()`, taken before the early return; and a sweep of stale `host-pipelines.bin.tmp-<digits>-<digits>` / `early-pipelines.txt.tmp-<digits>-<digits>` regular files in `use_pipeline_cache()`, immediately for the own pid and after 10 minutes for other pids, because the cache folder is shared and there is no single-instance guard. Reference: https://github.com/LaunchDoesntCode/VI-Port/pull/174
oni-swr commented 2026-11-25 15:04:35 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by oni-swr on 2026-11-25T15:03:41Z.


Claimed the stale staging-file sweep half on #1633 (use_pipeline_cache() sweeping host-pipelines.bin.tmp-<digits>-<digits> and early-pipelines.txt.tmp-<digits>-<digits> regular files, own pid immediately and other pids after 10 minutes), leaving the save() lock half to open PR #2328 to avoid overlap.

AI-assisted (Claude Code / Claude Sonnet 5.5).

<!-- greyfinch-sync:Marvisak/VIctory:comment:7166240798 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2496#issuecomment-7166240798). Originally posted by [oni-swr](https://github.com/oni-swr) on 2026-11-25T15:03:41Z. --- Claimed the stale staging-file sweep half on #1633 (`use_pipeline_cache()` sweeping `host-pipelines.bin.tmp-<digits>-<digits>` and `early-pipelines.txt.tmp-<digits>-<digits>` regular files, own pid immediately and other pids after 10 minutes), leaving the `save()` lock half to open PR #2328 to avoid overlap. AI-assisted (Claude Code / Claude Sonnet 5.5).
Marvisak commented 2026-11-25 19:06:37 +00:00 (Migrated from github.com)
Author
Contributor

Imported from Marvisak/VIctory. Originally posted by Marvisak on 2026-11-25T18:50:56Z.


Automated triage for the maintainers.

Confirmed in main, in crates/victory-gpu/src/pipeline/library.rs. write_atomically stages each write in <file>.tmp-<pid>-<n> and removes it only when the write or rename returns an error. use_pipeline_cache only records the folder and sweeps nothing. So any write cut by TerminateProcess leaves a staging file that stays there for good.

save() returns early when nothing was added, without waiting for a save already running. One correction: WRITING is a single static lock shared by all files, not one per file. It is held for each write_atomically call, not across the whole save(), so the effect described here still holds.

Open PR #2328 makes saves run one at a time. The sweep of stale staging files has been claimed on #1633. No PR for it is linked in this thread yet.


Generated by Claude Code

<!-- greyfinch-sync:Marvisak/VIctory:comment:7171486105 --> Imported from [Marvisak/VIctory](https://github.com/Marvisak/VIctory/issues/2496#issuecomment-7171486105). Originally posted by [Marvisak](https://github.com/Marvisak) on 2026-11-25T18:50:56Z. --- <!-- victory-issue-triage v1 verdict=confirmed seen=2026-11-25T15:03:41Z at=2026-11-25T19:05:00Z --> Automated triage for the maintainers. Confirmed in main, in `crates/victory-gpu/src/pipeline/library.rs`. `write_atomically` stages each write in `<file>.tmp-<pid>-<n>` and removes it only when the write or rename returns an error. `use_pipeline_cache` only records the folder and sweeps nothing. So any write cut by `TerminateProcess` leaves a staging file that stays there for good. `save()` returns early when nothing was added, without waiting for a save already running. One correction: `WRITING` is a single static lock shared by all files, not one per file. It is held for each `write_atomically` call, not across the whole `save()`, so the effect described here still holds. Open PR #2328 makes saves run one at a time. The sweep of stale staging files has been claimed on #1633. No PR for it is linked in this thread yet. --- _Generated by [Claude Code](https://claude.ai/code)_
Sign in to join this conversation.
No labels
No milestone
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Reference
Marvisak/VIctory#2494
No description provided.