rust.missing_async_timeout
Stability
Medium
Detects async operations that can wait indefinitely without timeout bounds.
Why It Matters
Section titled “Why It Matters”Missing timeouts:
- Indefinite blocking — Operations never complete
- Resource exhaustion — Connections held forever
- Cascading failures — Stuck tasks affect other work
Example
Section titled “Example”// ❌ Before (no timeout)async fn fetch_data() -> Result<Data, Error> { let response = client.get(url).send().await?; Ok(response.json().await?)}// ✅ After (with timeout)use tokio::time::timeout;
async fn fetch_data() -> Result<Data, Error> { timeout(Duration::from_secs(30), async { let response = client.get(url).send().await?; Ok(response.json().await?) }) .await .map_err(|_| Error::Timeout)?}What Unfault Detects
Section titled “What Unfault Detects”- HTTP client calls without timeout
- Database operations without bounds
- Channel receives without timeout