Tidy-ups in diagnostics, switch-only and offline code: leaked handles, unbounded lists, ignored errors #227

Open
opened 2026-11-26 12:04:49 +00:00 by github-bot · 0 comments
Owner

@⁠kekonn on GitHub · 2026-11-26 12:03 UTC · original

These are verified, small, and off the default runtime path. They're follow-ups; anyone may pick one up.

  • Replay event leak. crates/victory-gpu/src/replay/gpu.rs: Worker creates an event (CreateEventW, ~34) and has no Drop. play.rs ~1460 makes one per 256 MiB upload batch, so one event leaks per batch (diagnostics builds). Fix: impl Drop for Worker that closes the event, like Rig in inplace.rs ~676.
  • Timeline writes after end(). crates/victory-gpu/src/timeline/record.rs put_of (~119) never checks on(). Waits or spans that straddle end() write into the next recording's slots 0 and on (VICTORY_TIMELINE). Fix: if !on() { return; } (optionally in stack() too).
  • Profile thread handles. crates/victory-loader/src/profile.rs: thread handles are closed only inside write(), after File::create succeeds (~150-161), so a bad path leaks them (VICTORY_PROFILE). Fix: impl Drop for Thread.
  • VICTORY_WATCH overflow. apps/victory/src/run.rs ~285: rva + 4 <= size overflows for a huge value. Fix: rva.checked_add(4).is_some_and(|e| e <= size), as at ~266.
  • Validator status and null slice. crates/victory-shader/src/emit/validator.rs: the GetStatus HRESULT is ignored (~190), so a failed call counts as validated; from_raw_parts(null, 0) is possible (~199). Fix: check the HRESULT, and use an empty slice when the pointer is null.
  • Census list. crates/victory-shader/src/emit/bitcode/census.rs: the thread-local WRITTEN list (~51/85) is emptied only by translate.rs. It grows in game runs with VICTORY_SHADER_CENSUS, and when the census file cannot be opened. Fix: cap it (for example the last 64), and call take before the early return in census_line.
  • Texture store and upcopy check. crates/victory-gpu/src/texstore.rs ~183: the channel of full texture copies is unbounded (VICTORY_TEXTURE_STORE). Fix: sync_channel(8) + try_send. host/upcheck.rs ~283-295: KNOWN grows per copy (VICTORY_UPCOPY_CHECK); keep only the ids still in carded_copies(). Leave texture/ahead.rs's error path alone for now: #72 edits the same function.
  • (optional) Silent skip in warm. crates/victory-gpu/src/pipeline/known.rs make() skips a missing entry silently (~289), which can make victory warm blame the wrong pipeline (warm.rs ~141-145, ~206-212). It's practically unreachable with an append-only file. Fix in known.rs, not in warm.rs, because #186 rewrites that loop.
**@⁠kekonn** on GitHub · 2026-11-26 12:03 UTC · [original](https://github.com/avatarmanz/VIctory-7900XTX/issues/227) These are verified, small, and off the default runtime path. They're follow-ups; anyone may pick one up. - [ ] **Replay event leak.** `crates/victory-gpu/src/replay/gpu.rs`: `Worker` creates an event (`CreateEventW`, ~34) and has no `Drop`. `play.rs` ~1460 makes one per 256 MiB upload batch, so one event leaks per batch (diagnostics builds). Fix: `impl Drop for Worker` that closes the event, like `Rig` in `inplace.rs` ~676. - [ ] **Timeline writes after end().** `crates/victory-gpu/src/timeline/record.rs` `put_of` (~119) never checks `on()`. Waits or spans that straddle `end()` write into the next recording's slots 0 and on (`VICTORY_TIMELINE`). Fix: `if !on() { return; }` (optionally in `stack()` too). - [ ] **Profile thread handles.** `crates/victory-loader/src/profile.rs`: thread handles are closed only inside `write()`, after `File::create` succeeds (~150-161), so a bad path leaks them (`VICTORY_PROFILE`). Fix: `impl Drop for Thread`. - [ ] **VICTORY_WATCH overflow.** `apps/victory/src/run.rs` ~285: `rva + 4 <= size` overflows for a huge value. Fix: `rva.checked_add(4).is_some_and(|e| e <= size)`, as at ~266. - [ ] **Validator status and null slice.** `crates/victory-shader/src/emit/validator.rs`: the `GetStatus` HRESULT is ignored (~190), so a failed call counts as validated; `from_raw_parts(null, 0)` is possible (~199). Fix: check the HRESULT, and use an empty slice when the pointer is null. - [ ] **Census list.** `crates/victory-shader/src/emit/bitcode/census.rs`: the thread-local `WRITTEN` list (~51/85) is emptied only by `translate.rs`. It grows in game runs with `VICTORY_SHADER_CENSUS`, and when the census file cannot be opened. Fix: cap it (for example the last 64), and call `take` before the early return in `census_line`. - [ ] **Texture store and upcopy check.** `crates/victory-gpu/src/texstore.rs` ~183: the channel of full texture copies is unbounded (`VICTORY_TEXTURE_STORE`). Fix: `sync_channel(8)` + `try_send`. `host/upcheck.rs` ~283-295: `KNOWN` grows per copy (`VICTORY_UPCOPY_CHECK`); keep only the ids still in `carded_copies()`. Leave `texture/ahead.rs`'s error path alone for now: #72 edits the same function. - [ ] *(optional)* **Silent skip in warm.** `crates/victory-gpu/src/pipeline/known.rs` `make()` skips a missing entry silently (~289), which can make `victory warm` blame the wrong pipeline (`warm.rs` ~141-145, ~206-212). It's practically unreachable with an append-only file. Fix in `known.rs`, not in `warm.rs`, because #186 rewrites that loop.
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 12:04:49 +00:00
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/avatarmanz--VIctory-7900XTX#227
No description provided.