{"record":{"id":"b88e3c93537317c9","repo":"risingwavelabs/risingwave","slug":"parallelism-should-not-be-zero","errorCode":null,"errorMessage":"parallelism should not be zero","messagePattern":"parallelism should not be zero","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/compute/src/lib.rs","lineNumber":191,"sourceCode":"    fn meta_addr(&self) -> MetaAddressStrategy {\n        self.meta_address.clone()\n    }\n}\n\nfn validate_opts(opts: &ComputeNodeOpts) {\n    let system_memory_available_bytes = system_memory_available_bytes();\n    if opts.total_memory_bytes > system_memory_available_bytes {\n        let error_msg = format!(\n            \"total_memory_bytes {} is larger than the total memory available bytes {} that can be acquired.\",\n            opts.total_memory_bytes, system_memory_available_bytes\n        );\n        tracing::error!(error_msg);\n        panic!(\"{}\", error_msg);\n    }\n    if opts.parallelism == 0 {\n        let error_msg = \"parallelism should not be zero\";\n        tracing::error!(error_msg);\n        panic!(\"{}\", error_msg);\n    }\n    let total_cpu_available = total_cpu_available().ceil() as usize;\n    if opts.parallelism > total_cpu_available {\n        let error_msg = format!(\n            \"parallelism {} is larger than the total cpu available {} that can be acquired.\",\n            opts.parallelism, total_cpu_available\n        );\n        tracing::warn!(error_msg);\n    }\n}\n\nuse crate::server::compute_node_serve;\n\n/// Start compute node\npub fn start(\n    opts: ComputeNodeOpts,\n    shutdown: CancellationToken,\n) -> Pin<Box<dyn Future<Output = ()> + Send>> {","sourceCodeStart":173,"sourceCodeEnd":209,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/compute/src/lib.rs#L173-L209","documentation":"validate_opts in the compute node's startup path panics when opts.parallelism is zero. The compute engine requires at least one parallel unit per node, so a zero parallelism setting is rejected before the node starts serving.","triggerScenarios":"Passing --parallelism 0 (or a config that resolves parallelism to 0) when starting the compute node; programmatically constructing ComputeNodeOpts with parallelism: 0.","commonSituations":"Templated config where a value was computed as 0 (e.g. dividing CPU count); copy-paste editing flags; CI scripts substituting an empty variable that becomes 0.","solutions":["Set --parallelism to a positive integer (typically the number of available CPU cores).","Fix the script/template that computes the value so it cannot yield 0 (e.g. default to 1 when unset).","Note there is also an upper bound: parallelism must not exceed total_cpu_available, so pick a value within [1, cpu_count]."],"exampleFix":"// before\n--parallelism 0\n// after\n--parallelism 8","handlingStrategy":"validation","validationCode":"# Before launch, validate parallelism\nparallelism = int(os.environ.get('RW_PARALLELISM', os.cpu_count()))\nassert parallelism >= 1, 'parallelism should not be zero'\nassert parallelism <= os.cpu_count(), 'parallelism exceeds total cpu available'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Never hardcode parallelism = 0; default to CPU count or 1.","Compute parallelism from CPU resources with a non-zero fallback.","Add a smoke-test startup check in CI so a 0 parallelism config fails before production."],"tags":["rust","config","parallelism","startup","compute-node"],"backgroundTag":"invalid-config-value","analyzedSha":"6469eb736d691e8e9b8a419a57edd6429ca77417","analyzedAt":"2026-09-11T21:06:21.487Z","contentChangedAt":"2026-09-11T21:06:21.487Z","schemaVersion":2},"datasetVersion":"2026-09-14T16:17:12.679Z"}