risingwavelabs/risingwave · critical

The total memory size ({}) is too small. It must be at least

Error message

The total memory size ({}) is too small. It must be at least {} MB.

What it means

reserve_memory_bytes in src/compute/src/memory/config.rs panics when the compute node's configured total_memory_bytes is smaller than MIN_COMPUTE_MEMORY_MB. RisingWave reserves memory (for stacks, code segments, allocation overhead, network buffers) using a gradient proportion, and this guarantee is impossible if total memory is below the minimum threshold.

Source

Thrown at src/compute/src/memory/config.rs:54

const COMPACTOR_MEMORY_DEFAULT_PROPORTION: f64 = 0.1;

const STORAGE_BLOCK_CACHE_MEMORY_PROPORTION: f64 = 0.3;

const STORAGE_SHARED_BUFFER_MAX_MEMORY_MB: usize = 4096;
const STORAGE_META_CACHE_MEMORY_PROPORTION: f64 = 0.4;
const STORAGE_SHARED_BUFFER_MEMORY_PROPORTION: f64 = 0.3;

/// The proportion of compute memory used for batch processing.
const COMPUTE_BATCH_MEMORY_PROPORTION_FOR_STREAMING: f64 = 0.3;
const COMPUTE_BATCH_MEMORY_PROPORTION_FOR_SERVING: f64 = 0.6;

/// Each compute node reserves some memory for stack and code segment of processes, allocation
/// overhead, network buffer, etc. based on gradient reserve memory proportion. The reserve memory
/// size must be larger than `MIN_SYSTEM_RESERVED_MEMORY_MB`
pub fn reserve_memory_bytes(opts: &ComputeNodeOpts) -> (usize, usize) {
    if opts.total_memory_bytes < MIN_COMPUTE_MEMORY_MB << 20 {
        panic!(
            "The total memory size ({}) is too small. It must be at least {} MB.",
            convert(opts.total_memory_bytes as _),
            MIN_COMPUTE_MEMORY_MB
        );
    }

    // If `reserved_memory_bytes` is not set, calculate total_memory_bytes based on gradient reserve memory proportion.
    let reserved = opts
        .reserved_memory_bytes
        .unwrap_or_else(|| gradient_reserve_memory_bytes(opts.total_memory_bytes));

    // Should have at least `MIN_SYSTEM_RESERVED_MEMORY_MB` for reserved memory.
    let reserved = std::cmp::max(reserved, MIN_SYSTEM_RESERVED_MEMORY_MB << 20);

    if reserved >= opts.total_memory_bytes {
        panic!(
            "reserved memory ({}) >= total memory ({}).",
            convert(reserved as _),

View on GitHub (pinned to 6469eb736d)

Solutions

  1. Increase total_memory_bytes (or the container memory limit) to at least MIN_COMPUTE_MEMORY_MB MB.
  2. Remove an overly small explicit --total-memory-bytes flag and let RisingWave derive it from the environment.
  3. Check MIN_COMPUTE_MEMORY_MB in src/compute/src/memory/config.rs for the current minimum and size the deployment accordingly.

Example fix

// before
--total-memory-bytes 104857600  # 100MB, below minimum
// after
--total-memory-bytes 2147483648  # 2GB, above MIN_COMPUTE_MEMORY_MB
Defensive patterns

Strategy: validation

Validate before calling

# Ensure container/config memory meets the compute-node minimum
min_mb = 512  # check MIN_COMPUTE_MEMORY_MB in src/compute/src/memory/config.rs
limit_mb = int(open('/sys/fs/cgroup/memory/memory.limit_in_bytes').read()) // (1024*1024)
assert limit_mb >= min_mb, f'container memory {limit_mb}MB below minimum {min_mb}MB'

Prevention

When it happens

Trigger: Starting a compute node with total_memory_bytes below MIN_COMPUTE_MEMORY_MB (<<20 conversion to bytes); running in a container with a very small memory limit; test setups with tiny memory values.

Common situations: Kubernetes pods with memory limits set to a few hundred MB; local dev VMs with minimal RAM; experiments lowering total_memory_bytes to test OOM behavior.

Understand the failure class

Background: "value must be between 0 and 1" / "out of range" / "must not be negative" errors: fixing range-validation failures across open-source libraries — this error's family across 42 libraries.

Related errors


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