Skip to content

rust.tokio.missing_runtime_config

Performance Medium

Detects Tokio runtime without proper configuration for production workloads.

Unconfigured runtime:

  • Default thread count - May not match workload
  • No thread naming - Harder to debug
  • Missing tuning - Suboptimal performance
// ❌ 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;
}
  • Default #[tokio::main] without configuration
  • Missing worker_threads specification
  • No thread naming for debugging

Unfault can add explicit runtime configuration.