{
  "id": "go/race-detector-found-data-race",
  "signature": "WARNING: DATA RACE",
  "signature_zh": "警告：数据竞争",
  "regex": "WARNING:\\ DATA\\ RACE",
  "domain": "go",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "The race detector (go test -race / go run -race) observed two goroutines accessing the same memory location concurrently, at least one being a write, without synchronization.",
  "root_cause_type": "generic",
  "root_cause_zh": "竞态检测器（go test -race / go run -race）观察到两个 goroutine 并发访问同一内存位置，至少一个是写操作，且没有同步。",
  "versions": [
    {
      "version": "1.18",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "1.20",
      "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": "The race still corrupts data in production; hiding it makes failures nondeterministic and worse.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Sleeps reduce detection probability but do not establish a happens-before relationship.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.92,
      "how": "Introduce sync.Mutex or sync/atomic around the shared variable; ensure happens-before via channel send/receive.",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "Pass data by value into goroutines or use immutable snapshots; run go test -race in CI to prevent regressions.",
      "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.9,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-30",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}