Skip to content

Remove the deadlock_detection feature#7497

Merged
emilk merged 7 commits intomainfrom
lucas/remove-deadlock-detection
Sep 4, 2025
Merged

Remove the deadlock_detection feature#7497
emilk merged 7 commits intomainfrom
lucas/remove-deadlock-detection

Conversation

@lucasmerlin
Copy link
Copy Markdown
Collaborator

Removes the deadlock_detection feature, since we now have a more primitive panic-after-30s deadlock detection which works well enough and even detects kinds of deadlocks that the deadlock_detection feature never supported.

@github-actions
Copy link
Copy Markdown

github-actions bot commented Sep 4, 2025

Preview available at https://egui-pr-preview.github.io/pr/7497-lucasremove-deadlock-detection
Note that it might take a couple seconds for the update to show up after the preview_build workflow has completed.

Comment on lines 146 to 440
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "deadlock_detection")]
#[cfg(test)]
mod tests_rwlock {
#![allow(clippy::disallowed_methods)] // Ok for tests
Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

The #[should_panic] tests still work, but now take 30s to complete.

Should I

  • remove the tests?
  • lower the DEADLOCK_DURATION to 10s?
  • keep it as is

I think I prefer setting DEADLOCK_DURATION to 10s, I think it should be fine considering no locks should be held longer than a frame

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I agree - 10s should be good enough for anyone

@emilk
Copy link
Copy Markdown
Owner

emilk commented Sep 4, 2025

It's worth noting what the old deadlock detector was good for, which was re-entrant locking of the same mutex on the same thread. In that case the detector would print the callstack of both lock calls. This used to be very important back when we returned locks from ctx.input() etc.

Copy link
Copy Markdown
Owner

@emilk emilk left a comment

Choose a reason for hiding this comment

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

sweet

Comment on lines 146 to 440
#[cfg(not(target_arch = "wasm32"))]
#[cfg(feature = "deadlock_detection")]
#[cfg(test)]
mod tests_rwlock {
#![allow(clippy::disallowed_methods)] // Ok for tests
Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

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

I agree - 10s should be good enough for anyone

@emilk emilk merged commit 80d61a7 into main Sep 4, 2025
47 checks passed
@emilk emilk deleted the lucas/remove-deadlock-detection branch September 4, 2025 10:57
lucasmerlin added a commit that referenced this pull request Sep 4, 2025
* related #7494 

Removes the `deadlock_detection` feature, since we now have a more
primitive panic-after-30s deadlock detection which works well enough and
even detects kinds of deadlocks that the `deadlock_detection` feature
never supported.
Masterchef365 pushed a commit to Masterchef365/egui that referenced this pull request Apr 3, 2026
* related emilk#7494

Removes the `deadlock_detection` feature, since we now have a more
primitive panic-after-30s deadlock detection which works well enough and
even detects kinds of deadlocks that the `deadlock_detection` feature
never supported.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants