{
  "id": "go/data-race-map-concurrent-write",
  "signature": "fatal error: concurrent map writes",
  "signature_zh": "fatal error：并发 map 写入",
  "regex": "fatal\\ error:\\ concurrent\\ map\\ writes",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "Two goroutines write to the same map without synchronization. The runtime detects concurrent writes and aborts the process.",
  "root_cause_type": "generic",
  "root_cause_zh": "两个 goroutine 在无同步的情况下写入同一个 map。运行时检测到并发写并中止进程。",
  "versions": [
    {
      "version": "1.16",
      "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"
    },
    {
      "version": "1.22",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Other writes still race; the runtime aborts on the first detected concurrent pair.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Sleeps don't eliminate races under real load; the crash just becomes intermittent.",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "var m sync.Map\nm.Store(k, v)\nv, ok := m.Load(k)",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.96,
      "how": "var mu sync.RWMutex\nmu.Lock()\nm[k] = v\nmu.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.89,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-03",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}