{"record":{"id":"f9c4965750d547e3","repo":"influxdata/influxdb","slug":"underlying-available-parallelism-error","errorCode":null,"errorMessage":"{underlying available_parallelism error}","messagePattern":"\\{underlying available_parallelism error\\}","errorType":"exception","errorClass":"std::io::Error","httpStatus":null,"severity":"error","filePath":"influxdb3_clap_blocks/src/tokio.rs","lineNumber":195,"sourceCode":"                        }\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                    });\n\n                    // worker thread count\n                    let num_threads = match self.num_threads {\n                        None => std::thread::available_parallelism()\n                            .map_err(|e| std::io::Error::new(std::io::ErrorKind::Other, e))?,\n                        Some(n) => n,\n                    };\n                    builder.worker_threads(num_threads.get());\n\n                    if self.disable_lifo == Some(true) {\n                        #[cfg(tokio_unstable)]\n                        {\n                            builder.disable_lifo_slot();\n                        }\n                        #[cfg(not(tokio_unstable))]\n                        {\n                            return Err(std::io::Error::new(\n                                std::io::ErrorKind::Other,\n                                \"disabling LIFO slot requires `tokio_unstable`\",\n                            ));\n                        }\n                    }\n","sourceCodeStart":177,"sourceCodeEnd":213,"githubUrl":"https://github.com/influxdata/influxdb/blob/06200ef96ba82c5f6727e5038a83af8e722c6875/influxdb3_clap_blocks/src/tokio.rs#L177-L213","documentation":"When no explicit worker-thread count is configured, the runtime builder uses std::thread::available_parallelism() to size the Tokio worker pool. If the OS refuses to report parallelism, the error is wrapped in an io::Error and propagated, aborting runtime construction.","triggerScenarios":"Creating the InfluxDB 3 Tokio runtime with num_threads unset on a system where available_parallelism() fails (e.g. cgroup/procfs metadata unavailable, restricted containers, exotic or unsupported platforms).","commonSituations":"Running in tightly sandboxed containers where /sys or /proc cpu info is masked; unusual OSes or seccomp profiles that block the syscalls used by available_parallelism.","solutions":["Set an explicit worker-thread count (e.g. num_threads / INFLUXDB3 number-of-worker-threads style config) so available_parallelism is never consulted.","Fix the execution environment so the OS exposes CPU count (unmask /proc, adjust container constraints).","Inspect the wrapped underlying error to identify why the OS could not report parallelism and address that platform issue."],"exampleFix":"// before\nlet runtime = tokio::Runtime::new()?; // relies on available_parallelism\n// after\nlet rt = builder(worker_threads(8)) // explicit count in runtime config\n    .build()?;","handlingStrategy":"fallback","validationCode":"// supply a fallback thread count when the OS cannot report parallelism\nfn worker_threads(configured: Option<usize>) -> usize {\n    configured\n        .or_else(|| std::thread::available_parallelism().ok().map(|n| n.get()))\n        .unwrap_or(4)\n}","typeGuard":null,"tryCatchPattern":"let num_threads = std::thread::available_parallelism()\n    .map(|n| n.get())\n    .unwrap_or_else(|e| {\n        log::warn!(\"available_parallelism failed ({e}); defaulting to 4\");\n        4\n    });","preventionTips":["Always configure an explicit worker-thread count in containers/sandboxed environments.","Log the wrapped error to identify platform restrictions early.","Test runtime startup inside the actual production container image."],"tags":["tokio","threads","available-parallelism","environment"],"backgroundTag":"parallelism-detection-failed","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"}