rust.tokio.missing_runtime_config
Performance
Medium
Detects Tokio runtime without proper configuration for production workloads.
Why It Matters
Section titled “Why It Matters”Unconfigured runtime:
- Default thread count - May not match workload
- No thread naming - Harder to debug
- Missing tuning - Suboptimal performance
Example
Section titled “Example”// ❌ Before (default runtime)#[tokio::main]async fn main() { run_server().await;}// ✅ After (configured runtime)use tokio::runtime::Builder;
fn main() { let runtime = Builder::new_multi_thread() .worker_threads(4) .thread_name("api-worker") .enable_all() .build() .unwrap();
runtime.block_on(async { run_server().await; });}
// Or with macro configuration:#[tokio::main(flavor = "multi_thread", worker_threads = 4)]async fn main() { run_server().await;}What Unfault Detects
Section titled “What Unfault Detects”- Default #[tokio::main] without configuration
- Missing worker_threads specification
- No thread naming for debugging
Auto-Fix
Section titled “Auto-Fix”Unfault can add explicit runtime configuration.