{
  "id": "go/deadlock-mutex-hold",
  "signature": "fatal error: all goroutines are asleep - deadlock! (mutex held by goroutine 1)",
  "signature_zh": "致命错误：所有goroutine都处于休眠状态 - 死锁！（互斥锁由goroutine 1持有）",
  "regex": "fatal\\ error:\\ all\\ goroutines\\ are\\ asleep\\ \\-\\ deadlock!\\ \\(mutex\\ held\\ by\\ goroutine\\ 1\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A goroutine holds a mutex and waits for another goroutine that also needs the same mutex, causing a deadlock.",
  "root_cause_type": "generic",
  "root_cause_zh": "一个goroutine持有互斥锁并等待另一个也需要该锁的goroutine，导致死锁。",
  "versions": [
    {
      "version": "1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.23",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Sleep does not resolve the deadlock; the other goroutine is also blocked.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The deadlock is due to mutex, not channel; buffering does not help.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This introduces data races and may corrupt data.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.85,
      "how": "Avoid holding mutexes while waiting for other resources. Use lock ordering or try-lock patterns.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "Use context.WithTimeout to break deadlocks by aborting the operation.",
      "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.88,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-07-18",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}