-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
ActionDispatch::DebugLocks #25344
ActionDispatch::DebugLocks #25344
Conversation
Only intended to be enabled when in use; by necessity, it sits above any reasonable access control.
Targeted for 5.0.1 because although it's a new feature, its whole purpose is to help people diagnose surprising behaviours they may encounter in 5.0: not having it until 5.1 would rather defeat the point. |
lgtm. Defaulting to auto- |
ActionDispatch::DebugLocks
Backported as ae40629 |
Good stuff! ... nice to get the backtraces :) (copy-pasted it into config/application.rb) |
@matthewd why no Changelog entry? This seems super useful! |
it is super useful, it confirmed that I do indeed have deadlocks in constant autoloading across my threads :) |
This middleware, along with what you might want to know after it's pointed out problems, is covered in #27494... which I really need to get back to, and get merged. 😔 |
While looking at #25117, I was again struck by how uninformative "hang on all new requests" is as a diagnostic output.
We'd thrown around the idea of checking thread statuses and guessing when things might be stuck, but I'm still nervous that we'd trip on too many legitimately slow operations.
Instead, I propose this middleware.
If your application appears to be experiencing a deadlock, you can insert this, then go to
/rails/locks
, to see output like:Naturally, we're able to provide lots of information about the actual interlock state (some of which is derived from duplicated logic for now, but that could be refactored later), but we can't offer much about whatever "other" lock is involved. However, the above example demonstrates that the backtraces may often be sufficient.