# 致命错误：所有goroutine都处于休眠状态 - 死锁！（互斥锁由goroutine 1持有）

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

## 根因

一个goroutine持有互斥锁并等待另一个也需要该锁的goroutine，导致死锁。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.0 | active | — | — |
| 1.23 | active | — | — |

## 解决方案

1. **** (85% 成功率)
   ```
   Avoid holding mutexes while waiting for other resources. Use lock ordering or try-lock patterns.
   ```
2. **** (80% 成功率)
   ```
   Use context.WithTimeout to break deadlocks by aborting the operation.
   ```

## 无效尝试

- **** — Sleep does not resolve the deadlock; the other goroutine is also blocked. (90% 失败率)
- **** — The deadlock is due to mutex, not channel; buffering does not help. (80% 失败率)
- **** — This introduces data races and may corrupt data. (70% 失败率)
