Skip to content

Conversation

@uael
Copy link
Contributor

@uael uael commented Dec 9, 2025

Description
Fix a deadlock in Device::maintain

Testing
Manually

Checklist

  • Run cargo fmt.
  • Run taplo format.
  • Run cargo clippy --tests. If applicable, add:
    • --target wasm32-unknown-unknown
  • Run cargo xtask test to run tests.
  • If this contains user-facing changes, add a CHANGELOG.md entry.

@cwfitzgerald cwfitzgerald self-assigned this Dec 9, 2025
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, minus some questions I'd like to fully understand before narrowing lock regions.


// Don't hold the locks while calling release_gpu_resources.
drop(fence);
drop(snatch_guard);
Copy link
Member

Choose a reason for hiding this comment

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

question: I think it's fine—but I'm not positive—to no longer be locking the snatch lock when we take the device lost closure. Tagging in @cwfitzgerald to double-check my conclusion here. Does that sound right, Connor?

Copy link
Member

Choose a reason for hiding this comment

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

I don't see any reason why this would be problematic. The snatch lock doesn't guard the device lost closure in any way.

@ErichDonGubler ErichDonGubler self-assigned this Dec 9, 2025

// Don't hold the locks while calling release_gpu_resources.
drop(fence);
drop(snatch_guard);
Copy link
Member

Choose a reason for hiding this comment

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

I don't see any reason why this would be problematic. The snatch lock doesn't guard the device lost closure in any way.

@uael uael force-pushed the uael/snatchguard-dead-lock branch from 0b4a9af to 67781e8 Compare December 15, 2025 06:14
Copy link
Member

@cwfitzgerald cwfitzgerald left a comment

Choose a reason for hiding this comment

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

Very nice!

@cwfitzgerald cwfitzgerald merged commit 17ebb2a into gfx-rs:trunk Dec 15, 2025
47 checks passed
@uael uael deleted the uael/snatchguard-dead-lock branch December 15, 2025 17:56
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.

3 participants