# fatal error: all goroutines are asleep - deadlock! (goroutine leak)

- **ID:** `go/goroutine-leak-on-channel-block`
- **Domain:** go
- **Category:** runtime_error
- **Verification:** ai_generated
- **Fix Rate:** 80%

## Root Cause

Goroutines are blocked waiting on channel operations that never complete, leading to a deadlock.

## Version Compatibility

| Version | Status | Introduced | Deprecated |
|---------|--------|------------|------------|
| 1.0 | active | — | — |
| 1.21 | active | — | — |

## Workarounds

1. **Use context with timeout to unblock goroutines** (90% success)
   ```
   ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)
defer cancel()
select {
case <-ctx.Done():
    return
case ch <- data:
}
   ```
2. **Ensure every send has a corresponding receive in a separate goroutine** (95% success)
   ```
   go func() { for v := range ch { process(v) } }()
ch <- data
   ```

## Dead Ends

- **Adding more goroutines to unblock** — More goroutines may also block if they depend on the same channels. (90% fail)
- **Increasing channel buffer size** — Buffering delays but does not solve the underlying missing consumer/producer. (80% fail)
