{"record":{"id":"73594126c0803446","repo":"influxdata/influxdb","slug":"multi-thread-alt-runtime-requires-tokio-unstable","errorCode":null,"errorMessage":"multi-thread-alt runtime requires `tokio_unstable`","messagePattern":"multi-thread-alt runtime requires `tokio_unstable`","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"influxdb3_clap_blocks/src/tokio.rs","lineNumber":172,"sourceCode":"                }\n\n                /// Creates the tokio runtime builder.\n                pub fn builder_with_name(&self, name: &str) -> Result<::tokio::runtime::Builder, std::io::Error> {\n                    // NOTE: no log macros will work here!\n                    //\n                    // That means use eprintln!() instead of error!() and so on. The log emitter\n                    // requires a running tokio runtime and is initialised after this function.\n\n                    let mut builder = match self.runtime_type {\n                        TokioRuntimeType::MultiThread => tokio::runtime::Builder::new_multi_thread(),\n                        TokioRuntimeType::MultiThreadAlt => {\n                            #[cfg(tokio_unstable)]\n                            {\n                                tokio::runtime::Builder::new_multi_thread()\n                            }\n                            #[cfg(not(tokio_unstable))]\n                            {\n                                return Err(std::io::Error::new(\n                                    std::io::ErrorKind::Other,\n                                    \"multi-thread-alt runtime requires `tokio_unstable`\",\n                                ));\n                            }\n                        }\n                    };\n\n                    // enable subsystems\n                    // - always enable timers\n                    builder.enable_time();\n                    builder.enable_io();\n\n                    // set up proper thread names\n                    let thread_counter = Arc::new(AtomicUsize::new(1));\n                    let name = name.to_owned();\n                    builder.thread_name_fn(move || {\n                        format!(\"InfluxDB 3 Core Tokio {} {}\", name, thread_counter.fetch_add(1, Ordering::SeqCst))\n                    });","sourceCodeStart":154,"sourceCodeEnd":190,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_clap_blocks/src/tokio.rs#L154-L190","documentation":"The tokio runtime builder in influxdb3_clap_blocks supports the `multi-thread-alt` runtime flavor only when tokio is built with the `tokio_unstable` cfg flag. Without it, the code returns an io::Error explaining that `tokio_unstable` is required, because `Builder::new_multi_thread_alt` does not exist in stable tokio.","triggerScenarios":"Configuring the runtime type to 'multi-thread-alt' (e.g. via InfluxDB 3's runtime-type config/CLI option) while running a binary compiled against stable tokio without RUSTFLAGS='--cfg tokio_unstable'.","commonSituations":"Operators copying a config that uses multi-thread-alt from a tuned deployment; developers testing the alternative scheduler locally without setting RUSTFLAGS; docker images built from stable toolchains.","solutions":["Rebuild with RUSTFLAGS=\"--cfg tokio_unstable\" so tokio exposes the multi-thread-alt builder.","Change the runtime type configuration back to the default 'multi-thread' flavor.","Pin/confirm the tokio version supports the requested flavor and that the cfg flag is applied to the whole dependency graph."],"exampleFix":"// before\ncargo build --release\n// after\nRUSTFLAGS=\"--cfg tokio_unstable\" cargo build --release","handlingStrategy":"validation","validationCode":"// reject multi-thread-alt early when tokio_unstable is absent\nfn validate_runtime_type(rt: &str) -> Result<(), String> {\n    if rt == \"multi-thread-alt\" && !cfg!(tokio_unstable) {\n        return Err(\"multi-thread-alt requires RUSTFLAGS='--cfg tokio_unstable'\".into());\n    }\n    Ok(())\n}","typeGuard":"fn supports_multithread_alt() -> bool { cfg!(tokio_unstable) }","tryCatchPattern":"match Runtime::build(...) {\n    Err(e) if e.to_string().contains(\"tokio_unstable\") => fall_back_to_default_runtime(),\n    Err(e) => return Err(e),\n    Ok(rt) => rt,\n}","preventionTips":["Set RUSTFLAGS=\"--cfg tokio_unstable\" for builds that use unstable runtime flavors.","Keep runtime-type config consistent with the binary's build flags.","Fail fast at config parse time, not at runtime construction."],"tags":["tokio","runtime","tokio-unstable","configuration"],"backgroundTag":"feature-not-enabled","analyzedSha":"06200ef96ba82c5f6727e5038a83af8e722c6875","analyzedAt":"2026-09-19T12:55:30.003Z","contentChangedAt":"2026-09-19T12:55:30.003Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}