| Previous | Next |
| EAGAIN | EAGAIN |
EDEADLK
A synchronization operation detected a deadlock condition
EDEADLK is the Darwin/POSIX errno for a detected deadlock condition. The exact trigger belongs to the API that returned it. For example, an error-checking mutex can report a self-deadlock attempt, while record-locking interfaces can detect a lock dependency cycle. The value should not be reduced to one mutex implementation rule.
What to capture
- Record the exact failing API, thread/process IDs, lock or file region, and all locks already held by the caller.
- For pthread synchronization, record the mutex type and ownership; normal, error-checking, recursive, and robust mutexes have different contracts.
- For file/record locks, map the owners and requested ranges so the dependency cycle can be reconstructed.
Recovery
Correct lock ordering or the operation that attempts an impossible acquisition. Retrying the same acquisition without changing ownership cannot resolve a deterministic deadlock. If the code intentionally supports recursive acquisition, use the synchronization primitive and attributes designed for that contract rather than ignoring EDEADLK.
When the API can also block indefinitely without returning this errno, use thread stacks and lock-owner diagnostics to investigate those hangs separately.
References
Looking for a different code? Search another status or error code.