{
  "id": "go/goroutine-leak-on-channel-block",
  "signature": "fatal error: all goroutines are asleep - deadlock! (goroutine leak)",
  "signature_zh": "致命错误：所有 goroutine 都处于休眠状态 - 死锁！（goroutine 泄漏）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(goroutine\\ leak\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Goroutines are blocked waiting on channel operations that never complete, leading to a deadlock.",
  "root_cause_type": "generic",
  "root_cause_zh": "Goroutine 在等待永远不会完成的通道操作时被阻塞，导致死锁。",
  "versions": [
    {
      "version": "1.0",
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Adding more goroutines to unblock",
      "why_fails": "More goroutines may also block if they depend on the same channels.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Increasing channel buffer size",
      "why_fails": "Buffering delays but does not solve the underlying missing consumer/producer.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use context with timeout to unblock goroutines",
      "success_rate": 0.9,
      "how": "ctx, cancel := context.WithTimeout(context.Background(), 5*time.Second)\ndefer cancel()\nselect {\ncase <-ctx.Done():\n    return\ncase ch <- data:\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Ensure every send has a corresponding receive in a separate goroutine",
      "success_rate": 0.95,
      "how": "go func() { for v := range ch { process(v) } }()\nch <- data",
      "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.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-05-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}