Skip to content

Internals

Deadlock Detection

How DIXY turns owner and waiter relationships into a wait-for graph and finds cycles.

The wait-for graph

Registries track which thread owns each lock and which thread is waiting for which lock. An edge A → B means "thread A waits for a lock that thread B owns". A monitor has exactly one owner, so a new owner replaces the previous one.

Finding cycles

DeadlockDetector runs a depth-first search over the graph. Any cycle is a deadlock: every thread in it waits for the next one, forever. Updates and detection are serialised with a ReentrantLock so the detector never sees half-applied changes.

Duplicate reports

The agent waits 30 seconds before re-reporting the same cycle.

Pinning cycles

PinningDetector keeps only cycles containing a PINS edge — deadlocks caused by a pinned virtual thread starving its carrier.

How it is tested

  • ClassicDeadlockEndToEndTest — platform-thread deadlock through the real pipeline
  • VirtualThreadPinningEndToEndTest — virtual-thread pinning
  • HybridPinningDeadlockEndToEndTest — deadlock correlated with pinning
  • GraphEngineTest — graph and cycle detection