# fatal error: 所有 goroutine 都休眠 - 死锁!（select 无就绪分支）

- **ID:** `go/select-blocked-forever-no-default`
- **领域:** go
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

含多个 channel 分支的 select 因没有任何分支就绪、且无 default 或超时，永久阻塞。常为生产者/消费者接线错误，预期的 channel 从未被写入。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.x | active | — | — |

## 解决方案

1. **** (90% 成功率)
   ```
   Add a context or timeout case to break the block and surface the bug:
select {
case v := <-ch:
    use(v)
case <-ctx.Done():
    return ctx.Err()
case <-time.After(30 * time.Second):
    return errors.New("select timeout")
}
   ```
2. **** (85% 成功率)
   ```
   Verify the producer actually sends on the expected channel and that the channel is not nil (sending to a nil channel blocks forever).
   ```

## 无效尝试

- **** — Turns the blocking select into a busy spin that burns CPU and still never handles the missing event. (80% 失败率)
- **** — If the root wiring is wrong, extra cases don't become ready and the deadlock persists. (70% 失败率)
