{
  "id": "go/goroutine-leak-n-goroutines-blocked-on-chan-receive-detect",
  "signature": "goroutine leak: N goroutines blocked on chan receive (detected by goleak)",
  "signature_zh": "goroutine 泄漏：N 个 goroutine 阻塞在 chan receive（由 goleak 检测）",
  "regex": "goroutine\\ leak:\\ N\\ goroutines\\ blocked\\ on\\ chan\\ receive\\ \\(detected\\ by\\ goleak\\)",
  "domain": "go",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Goroutines block forever on a channel receive because the sender exited or the channel is never closed.",
  "root_cause_type": "generic",
  "root_cause_zh": "goroutine 永远阻塞在 channel 接收上，因为发送方已退出或 channel 从未关闭。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Buffering delays the block but does not prevent it once the buffer fills; the leak returns under load.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Blocked goroutines are reachable and not garbage collected; GC cannot reclaim them.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "Pass a context.Context and select on ctx.Done(): select { case v := <-ch: handle(v); case <-ctx.Done(): return }.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Ensure the sender closes the channel when finished: defer close(ch) in the producer, so receivers unblock with the zero value.",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": null,
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-11-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}