tests: slot 133 teardown leaves nothing at vkDestroyDevice (RT-SLOT133-STANDIN-LEAK) #1716

Closed
leonida/mandy
Tyrannys wants to merge 0 commits from claude/slot133-standin-leak-adc6b3 into main

Pull request closed

This pull request cannot be reopened because the branch was deleted.

Tyrannys commented 2026-11-25 09:26:19 +00:00

Claimed in the coordination issue as: RT-SLOT133-STANDIN-LEAK (ubiquitarianism/leonida#1608)

Depends on: #1758

What and why

The finding in #1608 (and adrianmjim's run on #1558): after a slot 133 placement, vkDestroyDevice reports 57-63 objects that were never destroyed (VUID-vkDestroyDevice-device-05137) under LEONIDA_VK_VALIDATION=1. The leak comes from the test helper, not the runtime.

d3d12test::Ref had no assignment operator of its own, so placed = {}; copied a null pointer over the reference and never called Release. The placed texture kept its reference to the device proxy, and the whole D3D12 device was still alive at vkDestroyDevice. I took the runtime's slot 133 paths one at a time (provider refusal → host-address texture → committed stand-in) and none holds a reference after release.

adrianmjim's #1758 (TEST-REF-MOVE-ONLY) makes the same Ref change: move-only, and ref = {} releases. It is equivalent to the change this pull request first carried, so that part has been reverted here (in a new commit; the history is unchanged), and the Ref fix is left to #1758. This pull request now only adds a regression test for slot 133 teardown.

The new xbox_slot133_teardown test needs no game files. Through slot 133 on the Vulkan device behind the proxy, it places:

  • a 1280×720 format-118 depth target without UAV
  • a 256×256 RGBA8 texture
  • an RGBA8 render target
  • a buffer

It drops each one with = {} and checks that the proxy's reference count is back where it was. Then it releases the device and reads the validation error count only after vkDestroyDevice.

Tested

NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11, MSVC, Ninja RelWithDebInfo. Branch with current main (a73a57e13) merged in.

  • With #1758's d3d12_test_shaders.h (head a8a56cb47; it differs from main only in Ref): xbox_slot133_teardown passes plain and with LEONIDA_VK_VALIDATION=1, with no VUID reported.
  • Without the Ref fix (this branch on its own): it fails, with VUID-vkDestroyDevice-device-05137 for the objects of the device that is still alive. So this pull request should merge after #1758.
  • Earlier, with the Ref change, the whole ctest passed (403/403) and #1558's test was clean under validation. check_no_game_data.py on the changed files is clean. The game was not run.

GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11

AI-assisted: yes (Claude Code)

Checklist

  • Based on current main and merges cleanly (a conflicting pull request is labeled needs rebase).
  • One topic; follow-up work goes in a new pull request.
  • No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here.
  • A new translator rule is in the contract table of docs/design.md, with how it was confirmed. (n/a)

🤖 Generated with Claude Code

Claimed in the coordination issue as: RT-SLOT133-STANDIN-LEAK (ubiquitarianism/leonida#1608) Depends on: #1758 ### What and why The finding in #1608 (and adrianmjim's run on #1558): after a slot 133 placement, `vkDestroyDevice` reports 57-63 objects that were never destroyed (VUID-vkDestroyDevice-device-05137) under `LEONIDA_VK_VALIDATION=1`. The leak comes from the test helper, not the runtime. `d3d12test::Ref` had no assignment operator of its own, so `placed = {};` copied a null pointer over the reference and never called `Release`. The placed texture kept its reference to the device proxy, and the whole D3D12 device was still alive at `vkDestroyDevice`. I took the runtime's slot 133 paths one at a time (provider refusal → host-address texture → committed stand-in) and none holds a reference after release. adrianmjim's #1758 (TEST-REF-MOVE-ONLY) makes the same `Ref` change: move-only, and `ref = {}` releases. It is equivalent to the change this pull request first carried, so that part has been reverted here (in a new commit; the history is unchanged), and the `Ref` fix is left to #1758. This pull request now only adds a regression test for slot 133 teardown. The new `xbox_slot133_teardown` test needs no game files. Through slot 133 on the Vulkan device behind the proxy, it places: - a 1280×720 format-118 depth target without UAV - a 256×256 RGBA8 texture - an RGBA8 render target - a buffer It drops each one with `= {}` and checks that the proxy's reference count is back where it was. Then it releases the device and reads the validation error count only **after** `vkDestroyDevice`. ### Tested NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11, MSVC, Ninja RelWithDebInfo. Branch with current `main` (a73a57e13) merged in. - With #1758's `d3d12_test_shaders.h` (head a8a56cb47; it differs from `main` only in `Ref`): `xbox_slot133_teardown` passes plain and with `LEONIDA_VK_VALIDATION=1`, with no VUID reported. - Without the `Ref` fix (this branch on its own): it fails, with VUID-vkDestroyDevice-device-05137 for the objects of the device that is still alive. So this pull request should merge after #1758. - Earlier, with the `Ref` change, the whole `ctest` passed (403/403) and #1558's test was clean under validation. `check_no_game_data.py` on the changed files is clean. The game was not run. GPUs tested: NVIDIA GeForce RTX 4070 SUPER, driver 621.01, Windows 11 AI-assisted: yes (Claude Code) ### Checklist - [x] Based on current `main` and merges cleanly (a conflicting pull request is labeled `needs rebase`). - [x] One topic; follow-up work goes in a new pull request. - [x] No game data, keys or decryption (CONTRIBUTING.md), including in logs or reports quoted here. - [ ] A new translator rule is in the contract table of `docs/design.md`, with how it was confirmed. (n/a) 🤖 Generated with [Claude Code](https://claude.com/claude-code)
PierreEbele commented 2026-11-25 18:00:20 +00:00

Reviewed 573c918: the slot-133 teardown test and the D3D12 COM targets are MSVC/Windows-only, so they were not built or run here; its referenced symbols all check out against main's headers and the CMake registration matches the neighbouring xbox_gpu_label_test block. The header logic this PR changes is verified: a standalone arm64-Linux probe compiling Ref's special members verbatim (plus a sweep of all 46 files that include d3d12_test_shaders.h) shows placed = {} issuing 0 Release calls with main's Ref and exactly 1 with the PR's, moves and by-value returns working, and copies refused at compile time; nothing in-tree copies a Ref, aggregate-initializes one or copies a fixture holding one, so the deleted copies break no existing test. One wording nit: "Nothing on main copies a Ref or assigns {} to one" is not accurate - xbox_depth_storage_test.cpp:95 assigns {} (the leak site this PR fixes). No code findings.
AI-assisted review.

Recommendation: Merge

Reviewed 573c918: the slot-133 teardown test and the D3D12 COM targets are MSVC/Windows-only, so they were not built or run here; its referenced symbols all check out against main's headers and the CMake registration matches the neighbouring xbox_gpu_label_test block. The header logic this PR changes is verified: a standalone arm64-Linux probe compiling Ref's special members verbatim (plus a sweep of all 46 files that include d3d12_test_shaders.h) shows `placed = {}` issuing 0 Release calls with main's Ref and exactly 1 with the PR's, moves and by-value returns working, and copies refused at compile time; nothing in-tree copies a Ref, aggregate-initializes one or copies a fixture holding one, so the deleted copies break no existing test. One wording nit: "Nothing on main copies a Ref or assigns `{}` to one" is not accurate - xbox_depth_storage_test.cpp:95 assigns `{}` (the leak site this PR fixes). No code findings. AI-assisted review. **Recommendation:** Merge
ammonium231 commented 2026-11-26 02:16:23 +00:00

RTX 3090 / 621.40, validation on: clears the device-teardown leak in xbox_d16s8_refused_uav (main leaks 74 objects, with this PR 0). xbox_slot133_teardown is also clean.

RTX 3090 / 621.40, validation on: clears the device-teardown leak in xbox_d16s8_refused_uav (main leaks 74 objects, with this PR 0). xbox_slot133_teardown is also clean.
Tyrannys commented 2026-11-26 11:25:39 +00:00

Housekeeping: adrianmjim's #1758 makes the same d3d12test::Ref change (move-only, ref = {} releases), so I reverted that part here in a new commit. This PR now only adds the xbox_slot133_teardown test and depends on #1758. With #1758's header the test passes plain and under LEONIDA_VK_VALIDATION=1 (no VUIDs); without it, it fails with VUID-05137. That fits the verification of #1758 I posted there earlier. Thanks @adrianmjim! AI-assisted (Claude Code).

Housekeeping: adrianmjim's #1758 makes the same `d3d12test::Ref` change (move-only, `ref = {}` releases), so I reverted that part here in a new commit. This PR now only adds the `xbox_slot133_teardown` test and depends on #1758. With #1758's header the test passes plain and under `LEONIDA_VK_VALIDATION=1` (no VUIDs); without it, it fails with VUID-05137. That fits the verification of #1758 I posted there earlier. Thanks @adrianmjim! AI-assisted (Claude Code).
Tyrannys commented 2026-11-28 12:41:37 +00:00

Closing to free a PR slot. This PR now only adds the slot-133 teardown test, and that test needs #1758's d3d12test::Ref header, but #1758 was closed without merging. I can reopen it if someone brings that change back. AI-assisted (Claude Code).

Closing to free a PR slot. This PR now only adds the slot-133 teardown test, and that test needs #1758's `d3d12test::Ref` header, but #1758 was closed without merging. I can reopen it if someone brings that change back. AI-assisted (Claude Code).
Sign in to join this conversation.
No description provided.