# goroutine leak: N goroutines blocked on chan receive (detected by goleak)

- **ID:** `go/goroutine-leak-n-goroutines-blocked-on-chan-receive-detect`
- **Domain:** go
- **Category:** resource_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Goroutines block forever on a channel receive because the sender exited or the channel is never closed.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.18 | active | — | — |
| 1.21 | active | — | — |
| 1.23 | active | — | — |

## Workarounds

1. **** (92% success)
   ```
   Pass a context.Context and select on ctx.Done(): select { case v := <-ch: handle(v); case <-ctx.Done(): return }.
   ```
2. **** (90% success)
   ```
   Ensure the sender closes the channel when finished: defer close(ch) in the producer, so receivers unblock with the zero value.
   ```

## Dead Ends

- **** — Buffering delays the block but does not prevent it once the buffer fills; the leak returns under load. (80% fail)
- **** — Blocked goroutines are reachable and not garbage collected; GC cannot reclaim them. (95% fail)
