gfx-rs/wgpu

[core] Deadlock involving three locks

jimblandy opened this issue · 0 comments

The analysis in #5586 together with the lock ranks added in #5539 suggest that a deadlock could occur in the following circumstances:

  • One thread holds a lock on CommandBuffer::data taken in Global::command_encoder_drop while locking Device::life_tracker at the end of Device::untrack.
  • A second thread holds a lock on Device::life_tracker taken in Device::maintain while locking Device::temp_suspected in that same function.
  • A third thread holds a lock on Device::temp_suspected taken in Global::queue_submit while locking CommandBuffer::data in any of several places:
    • CommandBuffer::drop
    • CommandBuffer::is_finished
    • CommandBuffer::extract_baked_commands
    • later in Global::queue_submit itself