{
  "id": "go/goroutine-stack-growth-panic",
  "signature": "panic: runtime error: goroutine stack exceeds 1000000000-byte limit",
  "signature_zh": "恐慌：运行时错误：goroutine栈超过1000000000字节限制",
  "regex": "panic:\\ runtime\\ error:\\ goroutine\\ stack\\ exceeds\\ 1000000000\\-byte\\ limit",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A goroutine has infinite recursion or excessive stack usage, causing stack overflow.",
  "root_cause_type": "generic",
  "root_cause_zh": "goroutine存在无限递归或栈使用过多，导致栈溢出。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.19",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.20",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing stack size via debug.SetMaxStack",
      "why_fails": "Only postpones the crash; doesn't fix the underlying bug.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using more goroutines to distribute work",
      "why_fails": "Each goroutine has its own stack; doesn't solve recursion issue.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Convert recursion to iteration",
      "success_rate": 0.95,
      "how": "// Before: func factorial(n int) int { if n <= 1 { return 1 }; return n * factorial(n-1) }\n// After:\nfunc factorial(n int) int {\n    result := 1\n    for i := 2; i <= n; i++ {\n        result *= i\n    }\n    return result\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a bounded depth-first search with explicit stack",
      "success_rate": 0.9,
      "how": "type frame struct { n int; result int }\nstack := []frame{{n: initial}}\nfor len(stack) > 0 {\n    // process\n}",
      "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-07-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}