Skip to content

[core] Deadlock between device.tracker and device.snatchable_lock #5737

@sagudev

Description

@sagudev

Description
More deadlocks between queue.submit and poll_all devices (both threads are running device.maintain).

queue.submit thread:

  thread #107, name = 'WGPU'
    frame #0: 0x00007ffff6f2725d libc.so.6`syscall at syscall.S:38
    frame #1: 0x000055555bd3a8c2 servo`parking_lot::raw_rwlock::RawRwLock::wait_for_readers at linux.rs:112:13
    frame #2: 0x000055555bd3a8a5 servo`parking_lot::raw_rwlock::RawRwLock::wait_for_readers [inlined] <parking_lot_core::thread_parker::imp::ThreadParker as parking_lot_core::thread_parker::ThreadParkerT>::park at linux.rs:66:13
    frame #3: 0x000055555bd3a886 servo`parking_lot::raw_rwlock::RawRwLock::wait_for_readers at parking_lot.rs:635:36
    frame #4: 0x000055555bd3a70b servo`parking_lot::raw_rwlock::RawRwLock::wait_for_readers at parking_lot.rs:207:5
    frame #5: 0x000055555bd3a675 servo`parking_lot::raw_rwlock::RawRwLock::wait_for_readers at parking_lot.rs:600:5
    frame #6: 0x000055555bd3a675 servo`parking_lot::raw_rwlock::RawRwLock::wait_for_readers(self=0x00007ffeda27b5a8, timeout=Instant>{...}, prev_value=0) at raw_rwlock.rs:1017:17
    frame #7: 0x000055555bd37c8e servo`parking_lot::raw_rwlock::RawRwLock::lock_exclusive_slow(self=0x00007ffeda27b5a8, timeout=Instant>{...}) at raw_rwlock.rs:647:9
    frame #8: 0x000055555b1586d9 servo`wgpu_core::snatch::SnatchLock::write [inlined] <parking_lot::raw_rwlock::RawRwLock as lock_api::rwlock::RawRwLock>::lock_exclusive(self=0x00007ffeda27b5a8) at raw_rwlock.rs:73:26
    frame #9: 0x000055555b1586cb servo`wgpu_core::snatch::SnatchLock::write at rwlock.rs:500:9
    frame #10: 0x000055555b1586cb servo`wgpu_core::snatch::SnatchLock::write [inlined] wgpu_core::lock::vanilla::RwLock<T>::write at vanilla.rs:85:33
    frame #11: 0x000055555b1586cb servo`wgpu_core::snatch::SnatchLock::write(self=0x00007ffeda27b5a8) at snatch.rs:154:40
    frame #12: 0x000055555b0c0e89 servo`wgpu_core::resource::Texture<A>::destroy(self=<unavailable>) at resource.rs:878:32
    frame #13: 0x000055555b0131aa servo`wgpu_core::device::resource::Device<A>::maintain at resource.rs:3649:21
    frame #14: 0x000055555b012c12 servo`wgpu_core::device::resource::Device<A>::maintain(self=0x00007ffeda279010, fence_guard=wgpu_core::lock::vanilla::RwLockReadGuard<core::option::Option<wgpu_hal::vulkan::Fence>> @ 0x00007fff505f7760, maintain=<unavailable>, snatch_guard=<unavailable>) at resource.rs:476:13
    frame #15: 0x000055555b046a79 servo`wgpu_core::device::queue::<impl wgpu_core::global::Global>::queue_submit(self=<unavailable>, queue_id=<unavailable>, command_buffer_ids=<unavailable>) at queue.rs:1494:23

poll_all_devices thread:

  thread #108, name = 'WGPU poller'
    frame #0: 0x00007ffff6f2725d libc.so.6`syscall at syscall.S:38
    frame #1: 0x000055555bd3c477 servo`parking_lot::raw_mutex::RawMutex::lock_slow at linux.rs:112:13
    frame #2: 0x000055555bd3c45a servo`parking_lot::raw_mutex::RawMutex::lock_slow [inlined] <parking_lot_core::thread_parker::imp::ThreadParker as parking_lot_core::thread_parker::ThreadParkerT>::park at linux.rs:66:13
    frame #3: 0x000055555bd3c454 servo`parking_lot::raw_mutex::RawMutex::lock_slow at parking_lot.rs:635:36
    frame #4: 0x000055555bd3c3f9 servo`parking_lot::raw_mutex::RawMutex::lock_slow at parking_lot.rs:207:5
    frame #5: 0x000055555bd3c3f9 servo`parking_lot::raw_mutex::RawMutex::lock_slow at parking_lot.rs:600:5
    frame #6: 0x000055555bd3c3f9 servo`parking_lot::raw_mutex::RawMutex::lock_slow(self=0x00007ffeda27b5b0, timeout=Instant>{...}) at raw_mutex.rs:262:17
    frame #7: 0x000055555b148a84 servo`wgpu_core::device::life::LifetimeTracker<A>::triage_suspected [inlined] <parking_lot::raw_mutex::RawMutex as lock_api::mutex::RawMutex>::lock(self=0x00007ffeda27b5b0) at raw_mutex.rs:72:13
    frame #8: 0x000055555b148a76 servo`wgpu_core::device::life::LifetimeTracker<A>::triage_suspected at mutex.rs:223:9
    frame #9: 0x000055555b148a76 servo`wgpu_core::device::life::LifetimeTracker<A>::triage_suspected at vanilla.rs:29:27
    frame #10: 0x000055555b148a76 servo`wgpu_core::device::life::LifetimeTracker<A>::triage_suspected [inlined] wgpu_core::device::life::LifetimeTracker<A>::triage_suspected_render_bundles(self=<unavailable>, trackers=0x00007ffeda27b5b0) at life.rs:501:37
    frame #11: 0x000055555b148a76 servo`wgpu_core::device::life::LifetimeTracker<A>::triage_suspected(self=0x00007ffeda27b888, trackers=0x00007ffeda27b5b0) at life.rs:786:9
    frame #12: 0x000055555b16bfd7 servo`wgpu_core::device::resource::Device<A>::maintain(self=0x00007ffeda279010, fence_guard=wgpu_core::lock::vanilla::RwLockReadGuard<core::option::Option<wgpu_hal::vulkan::Fence>> @ r15, maintain=<unavailable>, snatch_guard=<unavailable>) at resource.rs:438:9
    frame #13: 0x000055555b156789 servo`wgpu_core::device::global::<impl wgpu_core::global::Global>::poll_all_devices at global.rs:2148:39
    frame #14: 0x000055555b156769 servo`wgpu_core::device::global::<impl wgpu_core::global::Global>::poll_all_devices at global.rs:2188:21
    frame #15: 0x000055555b15661f servo`wgpu_core::device::global::<impl wgpu_core::global::Global>::poll_all_devices(self=<unavailable>, force_wait=<unavailable>) at global.rs:2213:17

Repro steps
Servo servo/servo@5ef507e when running webgpu:api,validation,state,device_lost,destroy:createTexture,2d,uncompressed_format:*

Platform
wgpu-core d0a5e48

Metadata

Metadata

Assignees

No one assigned

    Labels

    type: bugSomething isn't working

    Type

    No type

    Projects

    Status

    No status

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions