{
  "id": "go/goroutine-stack-overflow",
  "signature": "runtime: goroutine stack exceeds 1000000000-byte limit",
  "signature_zh": "运行时：协程栈超过1000000000字节限制",
  "regex": "runtime:\\ goroutine\\ stack\\ exceeds\\ 1000000000\\-byte\\ limit",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A goroutine has infinite recursion or excessive stack allocation, causing stack overflow",
  "root_cause_type": "generic",
  "root_cause_zh": "协程存在无限递归或过多的栈分配，导致栈溢出",
  "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing stack size via runtime.GOMAXPROCS",
      "why_fails": "GOMAXPROCS controls parallelism, not stack size; stack limit is fixed by runtime",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using more goroutines to distribute work",
      "why_fails": "More goroutines do not reduce stack usage per goroutine; each still has its own stack",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Refactor recursive function to iterative approach",
      "success_rate": 0.9,
      "how": "func 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 tail recursion with proper termination condition",
      "success_rate": 0.85,
      "how": "func factorialTail(n, acc int) int {\n    if n == 0 {\n        return acc\n    }\n    return factorialTail(n-1, n*acc)\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-08-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}