{
  "id": "python/pytest-xdist-worker-timeout",
  "signature": "pytest.xdist.WorkerInterrupted: worker 'gw0' crashed or timed out after 300 seconds",
  "signature_zh": "pytest.xdist.WorkerInterrupted: 工作进程 'gw0' 在300秒后崩溃或超时",
  "regex": "pytest\\.xdist\\.WorkerInterrupted:\\ worker\\ 'gw0'\\ crashed\\ or\\ timed\\ out\\ after\\ 300\\ seconds",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A test worker in pytest-xdist took longer than the specified timeout (default 300s) to complete, often due to a hanging test, infinite loop, or slow external resource.",
  "root_cause_type": "generic",
  "root_cause_zh": "pytest-xdist中的测试工作进程执行时间超过指定的超时时间（默认300秒），通常是由于测试挂起、无限循环或外部资源缓慢。",
  "versions": [
    {
      "version": "3.0.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "3.1.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "Increasing the timeout limit globally without investigating the root cause",
      "why_fails": "This only delays the failure; the underlying issue (e.g., a hanging test) remains and may cause intermittent failures.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "Disabling xdist entirely to avoid the timeout",
      "why_fails": "This removes parallel execution benefits, slowing down the test suite significantly.",
      "fail_rate": 0.4,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Set a longer timeout for specific tests using pytest.mark.timeout or xdist's --timeout option",
      "success_rate": 0.75,
      "how": "pip install pytest-timeout\n@pytest.mark.timeout(600)\ndef test_slow_operation():\n    ...\nOr run: pytest --timeout=600 -n auto",
      "condition": "",
      "sources": []
    },
    {
      "action": "Identify and fix the hanging test by running it in isolation with verbose logging",
      "success_rate": 0.9,
      "how": "Run the test individually: pytest tests/test_slow.py -v --timeout=60\nAdd logging to identify where it hangs, then fix the infinite loop or resource issue.",
      "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.83,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-04-05",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}