# fatal error: all goroutines are asleep - deadlock! (mutex lock ordering)

- **ID:** `go/deadlock-two-mutexes`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Two goroutines acquire mutexes A and B in opposite orders, each waiting for the other's lock.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.0+ | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   // always lock A then B
muA.Lock()
defer muA.Unlock()
muB.Lock()
defer muB.Unlock()
   ```
2. **** (88% success)
   ```
   var mu sync.Mutex
mu.Lock()
defer mu.Unlock()
// access both A and B
   ```

## Dead Ends

- **** — Busy retry burns CPU and does not guarantee progress; can still livelock. (70% fail)
- **** — Serializes everything, destroying concurrency, and may still deadlock with other lock paths. (60% fail)
