The device-removed report reaches the log when two threads find the device gone #2

Closed
github-bot wants to merge 1 commit from github-bot/gh-2 into main AGit
Owner

@⁠tbarnavon on GitHub · 2026-11-28 17:52 UTC · original
tbarnavon:windows/removal-report-race → main · +13 −8 · 1 files · 1 commits · closed without merging

What

log_removal_context used an AtomicBool swap to say the report once. The first thread to find the host device removed swapped it and began gathering the report (removal_context, removal_data); a second thread that found the device removed meanwhile saw the flag set, returned at once, and went on in fail to end the process. The report was then never written.

A std::sync::Once instead: the second thread waits until the first has said it, then ends the process as before. Nothing else changes.

Why

On Windows (RX 6900 XT) runs that lost the device ended with only no host list for a state prelude; device removed …, with nothing about the removal although VICTORY_D3D12_DRED=light was on, because the submitting thread and another one found the loss within the same millisecond. With the change the trail, the breadcrumbs and the DRED data are in every such log.

Tested

  • cargo check -p victory-gpu and cargo check -p victory --features diagnostics
  • Device losses on the PC above: the report is logged each time.

🤖 Generated with Claude Code

**@⁠tbarnavon** on GitHub · 2026-11-28 17:52 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/2) `tbarnavon:windows/removal-report-race` → `main` · +13 −8 · 1 files · 1 commits · closed without merging ## What `log_removal_context` used an `AtomicBool` swap to say the report once. The first thread to find the host device removed swapped it and began gathering the report (`removal_context`, `removal_data`); a second thread that found the device removed meanwhile saw the flag set, returned at once, and went on in `fail` to end the process. The report was then never written. A `std::sync::Once` instead: the second thread waits until the first has said it, then ends the process as before. Nothing else changes. ## Why On Windows (RX 6900 XT) runs that lost the device ended with only `no host list for a state prelude; device removed …`, with nothing about the removal although `VICTORY_D3D12_DRED=light` was on, because the submitting thread and another one found the loss within the same millisecond. With the change the trail, the breadcrumbs and the DRED data are in every such log. ## Tested - `cargo check -p victory-gpu` and `cargo check -p victory --features diagnostics` - Device losses on the PC above: the report is logged each time. 🤖 Generated with [Claude Code](https://claude.com/claude-code)
log_removal_context said the report once: the first thread to find the
host device removed swapped the flag and began gathering it, and a second
thread that found it removed in the meantime saw the flag set, returned,
and went on in `fail` to end the process. The report, the one place that
names the cause, was then never written: on Windows (RX 6900 XT) runs that
lost the device ended with "no host list for a state prelude" and nothing
about the removal, though DRED was on.

A `Once` instead of the flag: the second thread waits until the first has
said it, then ends the process as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
github-bot locked as GitHub sync and limited conversation to collaborators 2026-12-01 07:40:59 +00:00
github-bot closed this pull request 2026-12-03 02:14:35 +00:00
Author
Owner

@⁠goldfishdev on GitHub · 2026-12-03 02:13 UTC · original

The Once fix is already in main from fe13f18. The only remaining diff is the old if !(trail_on() || dred_any()) return; guard; main now logs the removal context unconditionally, so rebasing this would re-suppress that line. Closing as applied — thanks.

**@⁠goldfishdev** on GitHub · 2026-12-03 02:13 UTC · [original](https://github.com/lobomfz/VIctory-xmem/pull/2#issuecomment-7365222683) The `Once` fix is already in main from fe13f18. The only remaining diff is the old `if !(trail_on() || dred_any()) return;` guard; main now logs the removal context unconditionally, so rebasing this would re-suppress that line. Closing as applied — thanks.

Pull request closed

This discussion has been locked. Commenting is limited to contributors.
No description provided.