{
  "id": "python/pytest-timeout-thread-stuck",
  "signature": "Failed: Timeout (>60.0s) from pytest-timeout.\n=== 1 failed in 60.12s ===",
  "signature_zh": "Failed: 来自 pytest-timeout 的超时 (>60.0s)。\n=== 1 failed in 60.12s ===",
  "regex": "Failed:\\ Timeout\\ \\(>60\\.0s\\)\\ from\\ pytest\\-timeout\\.\\\n===\\ 1\\ failed\\ in\\ 60\\.12s\\ ===",
  "domain": "python",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A test blocks on a network call, lock, or thread join without a timeout; pytest-timeout's signal method cannot interrupt C-level blocking calls or non-main threads.",
  "root_cause_type": "generic",
  "root_cause_zh": "测试在没有超时的情况下阻塞在网络调用、锁或线程 join 上；pytest-timeout 的信号方法无法中断 C 层阻塞调用或非主线程。",
  "versions": [
    {
      "version": "2.3.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "2.4.x",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "Merely postpones failure; the underlying hang remains and CI time balloons. Flaky suites still fail on slower machines.",
      "fail_rate": 0.7,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "The thread method cannot kill the stuck thread; it only raises in the main thread, leaving resources leaked and the process hung.",
      "fail_rate": 0.8,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "",
      "success_rate": 0.93,
      "how": "import requests\nresp = requests.get(url, timeout=5)\n\n# For threads:\nthread.join(timeout=5)\nassert not thread.is_alive()",
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "success_rate": 0.88,
      "how": "# pyproject.toml\n[tool.pytest.ini_options]\ntimeout = 30\ntimeout_method = \"signal\"\n# Ensure no test spawns daemon threads that outlive the test",
      "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.84,
  "fix_success_rate": 0.8,
  "resolvable": "partial",
  "first_seen": "2024-05-27",
  "last_confirmed": "2025-01-01",
  "last_updated": "2025-01-01",
  "evidence_count": 0,
  "tags": [],
  "locale": "en",
  "aliases": []
}