rust.missing_select_timeout
Stability
Medium
Detects tokio::select! without a timeout branch that can wait indefinitely.
Why It Matters
Section titled “Why It Matters”Select without timeout:
- Indefinite waiting — Can block forever if no branch completes
- Resource leaks — Held resources never released
- Stuck tasks — No recovery from stalled operations
Example
Section titled “Example”// ❌ Before (no timeout)tokio::select! { result = operation_a() => handle_a(result), result = operation_b() => handle_b(result),}// ✅ After (with timeout)tokio::select! { result = operation_a() => handle_a(result), result = operation_b() => handle_b(result), _ = tokio::time::sleep(Duration::from_secs(30)) => { tracing::warn!("Operations timed out"); return Err(Error::Timeout); }}What Unfault Detects
Section titled “What Unfault Detects”tokio::select!withoutsleepor timeout branch- Long-running selects without bounds