thread 'main' attempted to acquire a snatch lock recursively
Description Device loss can cause lock contention due to lock guards being in scope while trying to write.
thread 'main' panicked at C:\Users\okko-\Programming\wgpu\wgpu-core\src\resource.rs:740:73:
thread 'main' attempted to acquire a snatch lock recursively.
- Currently trying to acquire a write lock at C:\Users\okko-\Programming\wgpu\wgpu-core\src\resource.rs:740:73
- Previously acquired a read lock at C:\Users\okko-\Programming\wgpu\wgpu-core\src\device\queue.rs:1043:55
Probably since #6229
Repro steps Cause a device is lost error on queue submit.
Device::release_gpu_resources will run into above error when trying to release buffers or others.
Expected vs observed behavior This lock contention should not occur.
Platform Trunk + Windows + RTX3080
noticed during investigations of another issue #6279
I guess generally device loss is rare, so this maybe isn't that big of a deal...
I need to figure out why I'm getting it in the first place
I guess generally device loss is rare, so this maybe isn't that big of a deal...
No, wgpu should handle device loss as gracefully as possible. Thanks for filing this!
release_gpu_resources can be removed once we move the registries into the Firefox bindings (https://github.com/gfx-rs/wgpu/issues/5121) since we can instead clear the registry on device loss.
c13fc3d14187bc07dc17d5b9c7f7bc8bb6daf007 resolved this.