Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[core] Deadlock involving five locks #5583

Open
Tracked by #5572
jimblandy opened this issue Apr 22, 2024 · 0 comments
Open
Tracked by #5572

[core] Deadlock involving five locks #5583

jimblandy opened this issue Apr 22, 2024 · 0 comments

Comments

@jimblandy
Copy link
Member

jimblandy commented Apr 22, 2024

The deadlock instrumentation in #5539 suggests that wgpu-core could deadlock if five threads happen to be doing exactly the wrong thing. Specifically, while running the boids example tests, there is some point at which a thread holds each lock in this list, while trying to acquire the next:

  • CommandBuffer::data
  • Buffer::map_state
  • Device::pending_writes
  • Device::life_tracker
  • Device::temp_suspected
  • CommandBuffer::data

Since CommandBuffer::data appears at both the start and the end of the list, that means that if five threads happened to be holding each of these locks while trying to acquire the following one simultaneously (six list entries; five threads to bridge each step), then wgpu-core would deadlock.

I've not observed this deadlock in practice, and given the level of coincidence required it seems unlikely to be high-impact.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant