Repository navigation
Runtime: release queue handles when holder registration runs out of memory - #9505
Conversation
|
Independent Linux x86-64 verification at
Synthetic and loader-free inputs for the failure test. Synthetic buffers/textures for the real-GPU test. AI-assisted (Codex). |
|
Native MSVC Debug check of 0eb99fbe on Windows x64, MSVC 19.44.35230, and Windows SDK 10.0.26100. The unmodified Synthetic Vulkan handles only. No Vulkan loader, GPU, or real memory exhaustion was involved. AI-assisted. |
|
Tested
AI-assisted run (Claude via OpenCode). |
Summary
Fix a host allocation failure in
VulkanQueueconstruction. The constructor creates a command pool and timeline semaphore beforeQueueHolds::attachgrows 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
Focused optimized test and ASan+UBSan: passed on macOS arm64, AppleClang 21. Baseline negative control fails five handle-cleanup assertions.
Full portable runtime build and all 65 registered CTest cases: 63 passed, two expected skips (
shader_library_corpus,vk_sync_validation). Executed in three disjoint batches covering every registered test.Real-GPU
vk_queue_teston Apple M5 Ultra / MoltenVK 1.4.2: base and head logs are byte-identical. Copy/direct/compute readbacks have zero bad bytes; prepared storage has zero stale bytes; the 256-submit backlog stays within the 64-command-buffer cap. This checks ordinary queue behavior; allocation failures are injected only in the CPU regression.Full semantic suite: 447 files / 5,957 tests; the 48 failure IDs exactly match the current baseline (47 image atomics guard, one image store d16).
compileall,make_game.py --help, changed-file no-game-data scan, andgit diff --check: passed.Constructor test passed with isolated compositions of Runtime: defer progress semaphore destruction during wait_retire_ticket and propagate device loss #6107, vulkan_backend: clear bindless_upload_semaphore_ in ~VulkanQueue before destroying progress_ #9058, runtime/src: remove TLS-slot-0 dependencies in shader_library and queue_holds #8326, and runtime: remove TLS-0 static init guards and thread_local in d3d12_vulkan_device, d3d12_com, queue_holds and shader_library #8364. fix(runtime): use context-owned timeline semaphore for cross-queue storage init #4561's patch already fails to apply to unchanged main at an earlier
vulkan_backend.hhunk; its early constructor guard does not alter the new cleanup path. Runtime: a queue waiting on a released fence goes on, as on the host (D3D-496, case 2) #4740 applies cleanly by patch check.Combined vulkan_scratch: preserve chunk ownership if collection allocation fails #8875, buffer_va_index: keep insertion atomic when host allocation fails #9035, vulkan_bindless: clean up replacement resources if retirement allocation fails #9240, Runtime: retain deferred deletion handles when batch allocation fails #9304, Runtime: preserve image registrations when host allocation fails #9433 and this patch apply cleanly to main
5d74c2723. The three affected backend regression targets (queue constructor, image registration, deferred deletion) build and pass together; this is a focused composition check, not a second full-suite run.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.