{
  "id": "go/goroutine-leak-unbounded",
  "signature": "fatal error: runtime: goroutine stack exceeds 1000000000-byte limit",
  "signature_zh": "致命错误：运行时：协程栈超过 1000000000 字节限制",
  "regex": "fatal\\ error:\\ runtime:\\ goroutine\\ stack\\ exceeds\\ 1000000000\\-byte\\ limit",
  "domain": "go",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Unbounded goroutine creation due to missing synchronization or infinite loop, causing stack memory exhaustion.",
  "root_cause_type": "generic",
  "root_cause_zh": "由于缺少同步或无限循环导致无限制创建协程，造成栈内存耗尽。",
  "versions": [
    {
      "version": "1.21",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing stack size via debug.SetMaxStack",
      "why_fails": "Does not fix leak; only delays exhaustion.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using runtime.GOMAXPROCS to limit concurrency",
      "why_fails": "Limits CPU parallelism, not goroutine count.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Use worker pool with buffered channel to limit goroutines",
      "success_rate": 0.95,
      "how": "sem := make(chan struct{}, 100); for _, task := range tasks { sem <- struct{}{}; go func(t Task) { defer func() { <-sem }(); process(t) }(task) }",
      "condition": "",
      "sources": []
    },
    {
      "action": "Add context cancellation to stop goroutines",
      "success_rate": 0.9,
      "how": "ctx, cancel := context.WithCancel(context.Background()); go func() { select { case <-ctx.Done(): return; default: work() } }(); cancel()",
      "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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}