influxdata/influxdb · error · std::io::Error

multi-thread-alt runtime requires `tokio_unstable`

Error message

multi-thread-alt runtime requires `tokio_unstable`

What it means

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.

Solutions

  1. Rebuild with RUSTFLAGS="--cfg tokio_unstable" so tokio exposes the multi-thread-alt builder.
  2. Change the runtime type configuration back to the default 'multi-thread' flavor.
  3. Pin/confirm the tokio version supports the requested flavor and that the cfg flag is applied to the whole dependency graph.

Example fix

// before
cargo build --release
// after
RUSTFLAGS="--cfg tokio_unstable" cargo build --release
Defensive patterns

Strategy: validation

Validate before calling

// reject multi-thread-alt early when tokio_unstable is absent
fn validate_runtime_type(rt: &str) -> Result<(), String> {
    if rt == "multi-thread-alt" && !cfg!(tokio_unstable) {
        return Err("multi-thread-alt requires RUSTFLAGS='--cfg tokio_unstable'".into());
    }
    Ok(())
}

Type guard

fn supports_multithread_alt() -> bool { cfg!(tokio_unstable) }

Try / catch

match Runtime::build(...) {
    Err(e) if e.to_string().contains("tokio_unstable") => fall_back_to_default_runtime(),
    Err(e) => return Err(e),
    Ok(rt) => rt,
}

Prevention

When it happens

Trigger: 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'.

Common situations: 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.

Related errors


AI-assisted analysis of influxdata/influxdb@06200ef96b (2026-09-19). Data as JSON: /api/errors/73594126c0803446. Report an issue: GitHub.

Appendix: source

Thrown at influxdb3_clap_blocks/src/tokio.rs:172

                }

                /// Creates the tokio runtime builder.
                pub fn builder_with_name(&self, name: &str) -> Result<::tokio::runtime::Builder, std::io::Error> {
                    // NOTE: no log macros will work here!
                    //
                    // That means use eprintln!() instead of error!() and so on. The log emitter
                    // requires a running tokio runtime and is initialised after this function.

                    let mut builder = match self.runtime_type {
                        TokioRuntimeType::MultiThread => tokio::runtime::Builder::new_multi_thread(),
                        TokioRuntimeType::MultiThreadAlt => {
                            #[cfg(tokio_unstable)]
                            {
                                tokio::runtime::Builder::new_multi_thread()
                            }
                            #[cfg(not(tokio_unstable))]
                            {
                                return Err(std::io::Error::new(
                                    std::io::ErrorKind::Other,
                                    "multi-thread-alt runtime requires `tokio_unstable`",
                                ));
                            }
                        }
                    };

                    // enable subsystems
                    // - always enable timers
                    builder.enable_time();
                    builder.enable_io();

                    // set up proper thread names
                    let thread_counter = Arc::new(AtomicUsize::new(1));
                    let name = name.to_owned();
                    builder.thread_name_fn(move || {
                        format!("InfluxDB 3 Core Tokio {} {}", name, thread_counter.fetch_add(1, Ordering::SeqCst))
                    });

View on GitHub (pinned to 06200ef96b)