Skip to content

Runtime: release queue handles when holder registration runs out of memory - #9505

Merged
ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
WebIdentity1:codex/vulkan-queue-constructor-ownership
Nov 23, 2026
Merged

ItsNotRexed merged 1 commit into
ProjectLeonida:mainfrom
WebIdentity1:codex/vulkan-queue-constructor-ownership

Conversation

@WebIdentity1

@WebIdentity1 WebIdentity1 commented Nov 23, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fix a host allocation failure in VulkanQueue construction. The constructor creates a command pool and timeline semaphore before QueueHolds::attach grows its holder vector. If that growth throws, the queue destructor never runs; the constructor now destroys the created handles and rethrows.

A synthetic, loader-free regression uses the public context and queue classes with fake Vulkan procedures. It injects allocation failure at holder registration, checks exact-once cleanup, and constructs a replacement queue in the same context. It also covers a failed second queue while another queue remains live, command-pool creation failure, and semaphore creation failure.

Claim: #9401 (comment)

Validation

No real host OOM was induced on a GPU. Independent native MSVC Debug at this exact head passed the synthetic constructor test (report). Independent Linux GCC and Clang sanitizer checks also passed, with a failing base negative control and byte-identical RADV Renoir queue smoke (report). The test uses synthetic handles and Vulkan procedures only.

AI-assisted: yes.

@matheusfermiano-source

Copy link
Copy Markdown

Independent Linux x86-64 verification at 0eb99fbe.

  • The new vk_queue_constructor_oom CTest passed in a GCC 16.2.1 Release build. I compiled the exact same test against the parent's header in a scratch tree and reproduced all five handle-cleanup failures (exit 1).
  • The patched test passed under Clang ASan and UBSan with leak checking enabled. Only the CPU fixture injects the allocation failure.
  • Applied Runtime: preserve image registrations when host allocation fails #9433 (5f925021) on top in a separate scratch checkout. Both vk_queue_constructor_oom and vk_image_registration_oom built and passed together.
  • The real Vulkan vk_queue_test on AMD Radeon Graphics (RADV Renoir, Mesa 26.2.6) passed on parent and PR with byte-identical logs. Both cross-queue readbacks had zero bad bytes, the prepared storage had zero stale bytes, and 256 submissions used 63 command buffers (cap 64).

Synthetic and loader-free inputs for the failure test. Synthetic buffers/textures for the real-GPU test. AI-assisted (Codex).

@thehollowedone

Copy link
Copy Markdown

Native MSVC Debug check of 0eb99fbe on Windows x64, MSVC 19.44.35230, and Windows SDK 10.0.26100.

The unmodified vk_queue_constructor_oom CTest passed 1/1. The fixture observed one destruction per created handle after the simulated holder-registration failure, then successfully created a replacement queue in the same context. The already-live queue and the partial command-pool and semaphore creation cases also passed.

Synthetic Vulkan handles only. No Vulkan loader, GPU, or real memory exhaustion was involved. AI-assisted.

@sgonzalez-glitch

Copy link
Copy Markdown

Tested 0eb99fbe9 (as part of #9429, #9505, #9516, #9547, #9549 and #9558 merged together onto main 5d74c2723) on NVIDIA GeForce RTX 2080, driver 621.24 (32.0.16.2124), Windows 11, MSVC 19.44 RelWithDebInfo: pass.

AI-assisted: yes

@IAmTheSween

Copy link
Copy Markdown

Tested 0eb99fbe9 on NVIDIA GeForce RTX 5070 (Blackwell), driver 32.0.16.2114, Windows 11, MSVC 14.44 (VS 2022), RelWithDebInfo: pass. Applied as a patch onto main 5d74c27.

ctest -R vk_queue: vk_queue, vk_queue_query_sync and the new vk_queue_constructor_oom all pass (3/3). The full runtime build has no errors.

AI-assisted run (Claude via OpenCode).

@ItsNotRexed
ItsNotRexed merged commit 2a99db7 into ProjectLeonida:main Nov 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants