{
  "id": "go/goroutine-leak-on-waitgroup",
  "signature": "fatal error: all goroutines are asleep - deadlock! (WaitGroup)",
  "signature_zh": "致命错误：所有协程都在休眠 - 死锁！（WaitGroup）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(WaitGroup\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "WaitGroup的计数器未归零，主goroutine调用Wait，但子goroutine因阻塞而无法完成。",
  "root_cause_type": "generic",
  "root_cause_zh": "WaitGroup的计数器未归零，主goroutine调用Wait，但子goroutine因阻塞而无法完成。",
  "versions": [
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "超时后goroutine仍在运行，程序可能退出但资源泄漏。",
      "fail_rate": 0.6,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "关闭通道可能引发其他panic，且未解决阻塞原因。",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "使用select和done通道通知退出",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "ctx, cancel := context.WithCancel(context.Background()); go func(){ select { case <-ctx.Done(): return } }()",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}