Open simonask opened 5 months ago
This is really weird, and is seemingly caused by us setting a debug name? Then in the driver it calls reset event, assuming that information is correct - (note the random switch to vkEnumerateInstanceLayerProperties, suggesting that the trace isn't correct).
To work around this, you can pass the https://docs.rs/wgpu/latest/wgpu/struct.InstanceFlags.html#associatedconstant.DISCARD_HAL_LABELS to your instance flags to prevent us from passing in the labels.
Oh interesting, I can reproduce this on macOS with MoltenVK. It always happens after the 2nd frame has been presented in my case.
It isn't obvious from the stack trace that this is the same problem, but the reason I still believe that to be the case is that adding wgpu::InstanceFlags::DISCARD_HAL_LABELS
actually seems to fix the crash.
Backtrace:
vulkan_layer_chassis::BeginCommandBuffer(VkCommandBuffer_T*, VkCommandBufferBeginInfo const*) (@vulkan_layer_chassis::BeginCommandBuffer(VkCommandBuffer_T*, VkCommandBufferBeginInfo const*):42)
ash::device::Device::begin_command_buffer (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/ash-0.37.3+1.3.251/src/device.rs:2382)
wgpu_hal::vulkan::command::<impl wgpu_hal::CommandEncoder<wgpu_hal::vulkan::Api> for wgpu_hal::vulkan::CommandEncoder>::begin_encoding (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-hal-0.19.1/src/vulkan/command.rs:91)
wgpu_core::command::CommandEncoder<A>::open_pass (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-0.19.0/src/command/mod.rs:100)
wgpu_core::command::render::<impl wgpu_core::global::Global<G>>::command_encoder_run_render_pass_impl (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-0.19.0/src/command/render.rs:1359)
wgpu_core::command::render::<impl wgpu_core::global::Global<G>>::command_encoder_run_render_pass (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-core-0.19.0/src/command/render.rs:1288)
<wgpu::backend::wgpu_core::ContextWgpuCore as wgpu::context::Context>::command_encoder_end_render_pass (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/backend/wgpu_core.rs:1898)
<T as wgpu::context::DynContext>::command_encoder_end_render_pass (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/context.rs:2760)
<wgpu::RenderPass as core::ops::drop::Drop>::drop (/Users/simon/.cargo/registry/src/index.crates.io-6f17d22bba15001f/wgpu-0.19.1/src/lib.rs:4109)
core::ptr::drop_in_place<wgpu::RenderPass> (@core::ptr::drop_in_place<wgpu::RenderPass>:10)
Description
Occasionally my tests crash with the following exception:
This happens in a test that exercises buffer memory mapping, but the stack trace does not point to memory mapping facilities in any obvious way. Rather it happens at different points, but always in connection with
set_object_name()
being called in connection withcreate_buffer()
, sometimes even while creating the adapter/device pair when wgpu creates its internal staging buffers.I can't reproduce in release builds (but that could just be a timing thing), and I also haven't seen it when running with
cargo test --jobs 1
. The tests run in parallel (normalcargo test
) using headless adapters/devices, so other adapters and devices are potentially alive while this happens.The Vulkan spec for
vkResetEvent()
state that "Host access to event must be externally synchronized", but it's not clear to me whether theevent
here is shared in any way.Example stack trace:
Repro steps This is triggered deep into some custom engine code, but I'm not doing any unsafe shenanigans here, and so at minimum I would expect a validation error if I'm doing something wrong. If the problem isn't obvious to someone familiar with the code, I'll happily create a minimal repro case, just let me know.
Expected vs observed behavior Expected no crash. :-)
Platform Windows 11, wgpu 0.19.1, latest NVIDIA drivers