{
  "id": "go/goroutine-timer-leak",
  "signature": "fatal error: runtime: out of memory (timer leak)",
  "signature_zh": "致命错误：运行时：内存不足（定时器泄漏）",
  "regex": "fatal\\ error:\\ runtime:\\ out\\ of\\ memory\\ \\(timer\\ leak\\)",
  "domain": "go",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "Creating time.Timer or time.Ticker without stopping them, causing goroutine leak and memory exhaustion.",
  "root_cause_type": "generic",
  "root_cause_zh": "创建time.Timer或time.Ticker而不停止它们，导致协程泄漏和内存耗尽。",
  "versions": [
    {
      "version": "1.0",
      "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": "Using time.After repeatedly without reset",
      "why_fails": "time.After creates new timer each call; old timers are not garbage collected until fired.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Ignoring ticker stop in defer",
      "why_fails": "Ticker continues to tick; goroutine leaks.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Always stop timers and tickers when done",
      "success_rate": 0.95,
      "how": "ticker := time.NewTicker(time.Second)\ndefer ticker.Stop()\nfor range ticker.C {\n    // do work\n}",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use time.After with select and timeout",
      "success_rate": 0.85,
      "how": "select {\ncase <-ch:\ncase <-time.After(5 * time.Second):\n    // timeout\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": "2025-12-20",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}