# 致命错误：所有 goroutine 都已休眠 - 死锁！（对已持有的 sync.Mutex.Lock 再次加锁）

- **ID:** `go/mutex-double-lock-self-deadlock`
- **领域:** go
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

同一个 goroutine 对不可重入的 sync.Mutex 调用两次 Lock()，或已加锁的方法调用另一个锁定同一互斥锁的方法。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.18 | active | — | — |
| 1.22 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   Split into exported methods that lock and unexported helpers that assume the lock is held; never call Lock inside a locked section
   ```
2. **** (85% 成功率)
   ```
   Use defer mu.Unlock() consistently and audit call chains for re-entrancy
   ```

## 无效尝试

- **** — The goroutine itself holds the lock; retry never succeeds (90% 失败率)
- **** — RLock while holding RLock is allowed but Lock after RLock still deadlocks (75% 失败率)
