# fatal error: sync: 解锁未加读锁的 RWMutex

- **ID:** `go/sync-rwmutex-unlock-of-unlocked`
- **领域:** go
- **类别:** runtime_error
- **验证级别:** ai_generated
- **修复率:** 80%

## 根因

在没有对应 RLock() 的情况下调用 RWMutex.RUnlock()。常因不同代码路径中 Lock/RLock 不匹配。

## 版本兼容性

| 版本 | 状态 | 引入 | 弃用 |
|------|------|------|------|
| 1.x | active | — | — |

## 解决方案

1. **** (95% 成功率)
   ```
   func (s *Store) Get(k string) (int, bool) {
    s.mu.RLock()
    defer s.mu.RUnlock()
    v, ok := s.m[k]
    return v, ok
}
   ```
2. **** (90% 成功率)
   ```
   func (s *Store) read(fn func()) {
    s.mu.RLock()
    defer s.mu.RUnlock()
    fn()
}
   ```

## 无效尝试

- **** — Loses read concurrency and does not fix the mismatch if the bug is elsewhere. (65% 失败率)
- **** — Fatal error; not recoverable. (100% 失败率)
