{
  "id": "rust/recv-timeout-timeout-error",
  "signature": "error: RecvTimeoutError::Timeout",
  "signature_zh": "错误：接收超时错误::超时",
  "regex": "RecvTimeoutError::Timeout",
  "domain": "rust",
  "category": "runtime_error",
  "subcategory": null,
  "root_cause": "A call to `recv_timeout` on a channel (e.g., `mpsc` or `crossbeam`) timed out because no message was sent within the specified duration.",
  "root_cause_type": "generic",
  "root_cause_zh": "在通道（例如 `mpsc` 或 `crossbeam`）上调用 `recv_timeout` 超时，因为在指定时间内没有消息发送。",
  "versions": [
    {
      "version": "rustc 1.75.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.76.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "rustc 1.77.0",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    },
    {
      "version": "crossbeam-channel 0.5.8",
      "introduced": null,
      "deprecated": null,
      "removed": null,
      "behavior_change": null,
      "status": "active"
    }
  ],
  "os_specific": {},
  "dead_ends": [
    {
      "action": "",
      "why_fails": "This only delays the failure; if the sender never sends, the timeout will eventually trigger again.",
      "fail_rate": 0.9,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "This can cause the program to hang forever if the sender fails or deadlocks, and does not address the missing message issue.",
      "fail_rate": 0.75,
      "condition": "",
      "sources": []
    },
    {
      "action": "",
      "why_fails": "`recv_timeout` returns a `Result`; `unwrap()` will panic on timeout, crashing the program instead of handling it gracefully.",
      "fail_rate": 0.95,
      "condition": "",
      "sources": []
    }
  ],
  "workarounds": [
    {
      "action": "Handle the timeout gracefully with `match` or `if let`: `if let Err(RecvTimeoutError::Timeout) = rx.recv_timeout(Duration::from_secs(5)) { eprintln!(\"timeout occurred, retrying...\"); }`",
      "success_rate": 0.85,
      "how": "Handle the timeout gracefully with `match` or `if let`: `if let Err(RecvTimeoutError::Timeout) = rx.recv_timeout(Duration::from_secs(5)) { eprintln!(\"timeout occurred, retrying...\"); }`",
      "condition": "",
      "sources": []
    },
    {
      "action": "Ensure the sender is correctly sending messages in all code paths, including error handling: `let _ = tx.send(message);` and check for `SendError` if the receiver is dropped.",
      "success_rate": 0.9,
      "how": "Ensure the sender is correctly sending messages in all code paths, including error handling: `let _ = tx.send(message);` and check for `SendError` if the receiver is dropped.",
      "condition": "",
      "sources": []
    },
    {
      "action": "Use a `select!` macro (e.g., from `crossbeam` or `tokio::select!`) to wait on multiple channels with timeouts, avoiding blocking on a single channel: `select! { recv(rx) -> msg => ..., default(Duration::from_secs(1)) => ... }`",
      "success_rate": 0.85,
      "how": "Use a `select!` macro (e.g., from `crossbeam` or `tokio::select!`) to wait on multiple channels with timeouts, avoiding blocking on a single channel: `select! { recv(rx) -> msg => ..., default(Duration::from_secs(1)) => ... }`",
      "condition": "",
      "sources": []
    }
  ],
  "workarounds_zh": [
    "Handle the timeout gracefully with `match` or `if let`: `if let Err(RecvTimeoutError::Timeout) = rx.recv_timeout(Duration::from_secs(5)) { eprintln!(\"timeout occurred, retrying...\"); }`",
    "Ensure the sender is correctly sending messages in all code paths, including error handling: `let _ = tx.send(message);` and check for `SendError` if the receiver is dropped.",
    "Use a `select!` macro (e.g., from `crossbeam` or `tokio::select!`) to wait on multiple channels with timeouts, avoiding blocking on a single channel: `select! { recv(rx) -> msg => ..., default(Duration::from_secs(1)) => ... }`"
  ],
  "transition_graph": {
    "leads_to": [],
    "preceded_by": [],
    "frequently_confused_with": []
  },
  "official_doc_url": "https://doc.rust-lang.org/std/sync/mpsc/enum.RecvTimeoutError.html",
  "official_doc_section": null,
  "error_code": null,
  "verification_tier": "ai_generated",
  "confidence": 0.85,
  "fix_success_rate": 0.8,
  "resolvable": "true",
  "first_seen": "2024-01-10",
  "last_confirmed": "2024-06-01",
  "last_updated": "2024-06-01",
  "evidence_count": 1,
  "tags": [],
  "locale": "en",
  "aliases": []
}