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

Open
opened 2026-11-26 05:07:30 +00:00 by github-bot · 2 comments
Owner

@⁠Makto94 on GitHub · 2026-11-25 14:50 UTC · original

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

**@⁠Makto94** on GitHub · 2026-11-25 14:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/2496) 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
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 05:07:30 +00:00
Author
Owner

@⁠oni-swr on GitHub · 2026-11-25 15:03 UTC · original

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).

**@⁠oni-swr** on GitHub · 2026-11-25 15:03 UTC · [original](https://github.com/Marvisak/VIctory/issues/2496#issuecomment-7166240798) 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).
Author
Owner

@⁠Marvisak on GitHub · 2026-11-25 18:50 UTC · original

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

**@⁠Marvisak** on GitHub · 2026-11-25 18:50 UTC · [original](https://github.com/Marvisak/VIctory/issues/2496#issuecomment-7171486105) <!-- 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)_
This discussion has been locked. Commenting is limited to contributors.
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.

Dependencies

No dependencies set

Reference
github/Marvisak--VIctory#2496
No description provided.