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

Prevent a deadlock when destroying resources #5216

Merged
merged 4 commits into from
Feb 7, 2024

Conversation

nical
Copy link
Contributor

@nical nical commented Feb 7, 2024

It's risky to get write access through the snatchlock from a drop implementation since the snatch lock is typically held for large scopes. This commit makes it so we defer snatching some resources to when the device is polled and we know the snatch lock is not held.

Testing

We hit this very easily in Firefox.

Checklist

  • Run cargo fmt.
  • Run cargo clippy.
  • Run cargo xtask test to run tests.

@nical nical requested a review from a team as a code owner February 7, 2024 13:56
It's risky to get write access through the snatchlock from a drop implementation since the snatch lock is typically held for large scopes. This commit makes it so we deffer snatching some resources to when the device is polled and we know the snatch lock is not held.
Copy link
Member

@ErichDonGubler ErichDonGubler left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Deadlock whack-a-mole, whee!

wgpu-core/src/device/resource.rs Outdated Show resolved Hide resolved
@ErichDonGubler ErichDonGubler enabled auto-merge (squash) February 7, 2024 15:56
@ErichDonGubler ErichDonGubler enabled auto-merge (squash) February 7, 2024 15:57
@ErichDonGubler ErichDonGubler merged commit 499bd64 into gfx-rs:trunk Feb 7, 2024
27 checks passed
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

Successfully merging this pull request may close these issues.

None yet

2 participants