{
  "id": "go/select-default-busy-loop",
  "signature": "error: CPU at 100%: select with default spins in tight loop",
  "signature_zh": "错误：CPU 占用 100%：带 default 的 select 在紧密循环中空转",
  "regex": "error:\\ CPU\\ at\\ 100%:\\ select\\ with\\ default\\ spins\\ in\\ tight\\ loop",
  "domain": "go",
  "category": "resource_error",
  "subcategory": null,
  "root_cause": "A 'for { select { case ...: default: } }' loop with a default branch never blocks, so it consumes a full CPU core spinning when no case is ready.",
  "root_cause_type": "generic",
  "root_cause_zh": "带有 default 分支的 'for { select { case ...: default: } }' 循环永不阻塞，当没有 case 就绪时它会占满一个 CPU 核心空转。",
  "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": "Yields but still spins at high CPU; just slightly less hot",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "Starves other goroutines and hides rather than fixes the spin",
      "fail_rate": 0.85,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.95,
      "how": "Remove the default branch so select blocks until a case is ready",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.85,
      "how": "If polling is required, add a time.After backoff: 'case <-time.After(100*time.Millisecond):'",
      "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.87,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-08-15",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}