{
  "id": "go/goroutine-ticker-stop-leak",
  "signature": "panic: runtime error: send on closed channel (ticker.C)",
  "signature_zh": "恐慌：运行时错误：向已关闭的通道发送数据（ticker.C）",
  "regex": "panic:\\ runtime\\ error:\\ send\\ on\\ closed\\ channel\\ \\(ticker\\.C\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Using a time.Ticker after it has been stopped, causing a send on a closed channel if the ticker fires.",
  "root_cause_type": "generic",
  "root_cause_zh": "在time.Ticker停止后使用它，如果计时器触发会导致向已关闭的通道发送数据。",
  "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"
    },
    {
      "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": "Ignoring ticker stop",
      "why_fails": "Causes goroutine leak and potential panic.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "Using recover() to catch panic",
      "why_fails": "Does not prevent data race on ticker.C.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Stop ticker and drain channel before closing",
      "success_rate": 0.9,
      "how": "ticker.Stop(); ticker.C = nil // or use select with done channel",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use time.NewTicker with a done channel",
      "success_rate": 0.95,
      "how": "done := make(chan struct{}); go func() { for { select { case <-ticker.C: // handle case <-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.82,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2025-01-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}