{
  "id": "go/rwmutex-unlock-without-lock",
  "signature": "panic: sync: RUnlock of unlocked RWMutex",
  "signature_zh": "panic：sync：解锁未加读锁的 RWMutex",
  "regex": "panic:\\ sync:\\ RUnlock\\ of\\ unlocked\\ RWMutex",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "RUnlock() was called without a matching RLock(), or the mutex was locked for writing instead. Mismatched lock/unlock pairs on RWMutex panic.",
  "root_cause_type": "generic",
  "root_cause_zh": "在没有对应 RLock() 的情况下调用 RUnlock()，或该锁实际是写锁。RWMutex 上锁/解锁配对不匹配会 panic。",
  "versions": [
    {
      "version": "1.18",
      "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"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Loses read concurrency benefits and may not fix the underlying mismatched lock/unlock logic.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Hides the bug; the RWMutex internal state may be inconsistent, leading to deadlocks later.",
      "fail_rate": 0.88,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.94,
      "how": "mu.RLock()\ndefer mu.RUnlock()\n// read-only access",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.9,
      "how": "func (s *Store) Get(k string) (V, bool) {\n    s.mu.RLock()\n    defer s.mu.RUnlock()\n    v, ok := s.m[k]\n    return v, ok\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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-06-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}