risingwavelabs/risingwave · critical

parallelism should not be zero

Error message

parallelism should not be zero

What it means

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.

Source

Thrown at src/compute/src/lib.rs:191

    fn meta_addr(&self) -> MetaAddressStrategy {
        self.meta_address.clone()
    }
}

fn validate_opts(opts: &ComputeNodeOpts) {
    let system_memory_available_bytes = system_memory_available_bytes();
    if opts.total_memory_bytes > system_memory_available_bytes {
        let error_msg = format!(
            "total_memory_bytes {} is larger than the total memory available bytes {} that can be acquired.",
            opts.total_memory_bytes, system_memory_available_bytes
        );
        tracing::error!(error_msg);
        panic!("{}", error_msg);
    }
    if opts.parallelism == 0 {
        let error_msg = "parallelism should not be zero";
        tracing::error!(error_msg);
        panic!("{}", error_msg);
    }
    let total_cpu_available = total_cpu_available().ceil() as usize;
    if opts.parallelism > total_cpu_available {
        let error_msg = format!(
            "parallelism {} is larger than the total cpu available {} that can be acquired.",
            opts.parallelism, total_cpu_available
        );
        tracing::warn!(error_msg);
    }
}

use crate::server::compute_node_serve;

/// Start compute node
pub fn start(
    opts: ComputeNodeOpts,
    shutdown: CancellationToken,
) -> Pin<Box<dyn Future<Output = ()> + Send>> {

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Set --parallelism to a positive integer (typically the number of available CPU cores).
  2. Fix the script/template that computes the value so it cannot yield 0 (e.g. default to 1 when unset).
  3. Note there is also an upper bound: parallelism must not exceed total_cpu_available, so pick a value within [1, cpu_count].

Example fix

// before
--parallelism 0
// after
--parallelism 8
Defensive patterns

Strategy: validation

Validate before calling

# Before launch, validate parallelism
parallelism = int(os.environ.get('RW_PARALLELISM', os.cpu_count()))
assert parallelism >= 1, 'parallelism should not be zero'
assert parallelism <= os.cpu_count(), 'parallelism exceeds total cpu available'

Prevention

When it happens

Trigger: Passing --parallelism 0 (or a config that resolves parallelism to 0) when starting the compute node; programmatically constructing ComputeNodeOpts with parallelism: 0.

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

Understand the failure class

Background: "Invalid value" and "allowed values are" config errors: what your library rejected and how to fix it — this error's family across 41 libraries.

Related errors


AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11). Data as JSON: /api/errors/b88e3c93537317c9. Report an issue: GitHub.