# 致命错误：所有 goroutine 都处于休眠状态 - 死锁！（goroutine 1 [信号量获取]）

- **ID:** `go/goroutine-blocked-on-mutex`
- **领域:** go
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

一个 goroutine 在尝试获取一个已被另一个也阻塞的 goroutine 锁定的互斥锁时阻塞，导致死锁。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.20 | active | — | — |
| 1.21 | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   mu1.Lock(); mu2.Lock(); defer mu1.Unlock(); defer mu2.Unlock()
   ```
2. **** (85% 成功率)
   ```
   if mu.TryLock(time.Second) { defer mu.Unlock() } else { handleTimeout() }
   ```

## 无效尝试

- **** — If logic requires same mutex, deadlock persists. (70% 失败率)
- **** — Sleep doesn't resolve circular wait. (90% 失败率)
