# goroutine 泄漏：goroutine 永久阻塞在 <-ch 上且无发送方

- **ID:** `go/goroutine-leak-blocked-recv`
- **领域:** go
- **类别:** resource_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

对一个永远不会被发送或关闭的 channel 执行接收操作，使 goroutine 永久挂起。

## 版本兼容性

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

## 解决方案

1. **** (94% 成功率)
   ```
   select {
case v := <-ch:
    handle(v)
case <-ctx.Done():
    return
}
   ```
2. **** (88% 成功率)
   ```
   defer close(ch)
   ```

## 无效尝试

- **** — Ignoring the timeout branch means the goroutine still leaks if it loops; also time.After leaks timers. (60% 失败率)
- **** — Closing from the receiver does not unblock the receive; the receive already returned zero value and panics on later sends. (70% 失败率)
