{
  "id": "go/fatal-error-sync-runlock-of-unlocked-rwmutex",
  "signature": "fatal error: sync: RUnlock of unlocked RWMutex",
  "signature_zh": "fatal error: sync: 解锁未加锁的 RWMutex",
  "regex": "fatal\\ error:\\ sync:\\ RUnlock\\ of\\ unlocked\\ RWMutex",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "RUnlock() is called without a matching RLock(), or the read lock was already released, corrupting the reader count.",
  "root_cause_type": "generic",
  "root_cause_zh": "在没有匹配 RLock() 的情况下调用 RUnlock()，或读锁已被释放，破坏了读者计数。",
  "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": "This sacrifices read concurrency and does not fix the missing RLock; if RUnlock is still called, it now mismatches Lock/Unlock.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Adds an extra lock that is never released, causing a permanent deadlock on the next writer.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.94,
      "how": "Pair defer mu.RUnlock() with mu.RLock() on the next line, and defer mu.Unlock() with mu.Lock(), never mixing them.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "Use a helper: func withReadLock(mu *sync.RWMutex, fn func()) { mu.RLock(); defer mu.RUnlock(); fn() }.",
      "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-08-11",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}