{
  "id": "go/semacquire-deadlock",
  "signature": "fatal error: semacquire: semacquire\n\ngoroutine 1 [semacquire]:\nsync.runtime_Semacquire(...)",
  "signature_zh": "fatal error: semacquire: semacquire\n\ngoroutine 1 [semacquire]:\nsync.runtime_Semacquire(...)",
  "regex": "fatal\\ error:\\ semacquire:\\ semacquire\\\n\\\ngoroutine\\ 1\\ \\[semacquire\\]:\\\nsync\\.runtime_Semacquire\\(\\.\\.\\.\\)",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A sync primitive (Mutex, WaitGroup, RWMutex) is held or waited on such that no progress is possible; runtime reports semacquire deadlock.",
  "root_cause_type": "generic",
  "root_cause_zh": "某个同步原语（Mutex、WaitGroup、RWMutex）被持有或等待，导致无法推进；运行时报告 semacquire 死锁。",
  "versions": [
    {
      "version": "1.18",
      "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": "",
      "why_fails": "Atomics cannot express compound invariants; logic still deadlocks.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Does not resolve lock ordering; can still deadlock.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.9,
      "how": "// Always lock A then B, never B then A.\nmuA.Lock(); muB.Lock(); ...; muB.Unlock(); muA.Unlock()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.8,
      "how": "if !mu.TryLock() {\n    return errors.New(\"lock timeout\")\n}\ndefer mu.Unlock()",
      "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-09",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}