{"record":{"id":"1611801b160ecb2a","repo":"risingwavelabs/risingwave","slug":"the-total-memory-size-is-too-small-it-must-b","errorCode":null,"errorMessage":"The total memory size ({}) is too small. It must be at least {} MB.","messagePattern":"The total memory size \\((.+?)\\) is too small\\. It must be at least (.+?) MB\\.","errorType":"panic","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"src/compute/src/memory/config.rs","lineNumber":54,"sourceCode":"\nconst COMPACTOR_MEMORY_DEFAULT_PROPORTION: f64 = 0.1;\n\nconst STORAGE_BLOCK_CACHE_MEMORY_PROPORTION: f64 = 0.3;\n\nconst STORAGE_SHARED_BUFFER_MAX_MEMORY_MB: usize = 4096;\nconst STORAGE_META_CACHE_MEMORY_PROPORTION: f64 = 0.4;\nconst STORAGE_SHARED_BUFFER_MEMORY_PROPORTION: f64 = 0.3;\n\n/// The proportion of compute memory used for batch processing.\nconst COMPUTE_BATCH_MEMORY_PROPORTION_FOR_STREAMING: f64 = 0.3;\nconst COMPUTE_BATCH_MEMORY_PROPORTION_FOR_SERVING: f64 = 0.6;\n\n/// Each compute node reserves some memory for stack and code segment of processes, allocation\n/// overhead, network buffer, etc. based on gradient reserve memory proportion. The reserve memory\n/// size must be larger than `MIN_SYSTEM_RESERVED_MEMORY_MB`\npub fn reserve_memory_bytes(opts: &ComputeNodeOpts) -> (usize, usize) {\n    if opts.total_memory_bytes < MIN_COMPUTE_MEMORY_MB << 20 {\n        panic!(\n            \"The total memory size ({}) is too small. It must be at least {} MB.\",\n            convert(opts.total_memory_bytes as _),\n            MIN_COMPUTE_MEMORY_MB\n        );\n    }\n\n    // If `reserved_memory_bytes` is not set, calculate total_memory_bytes based on gradient reserve memory proportion.\n    let reserved = opts\n        .reserved_memory_bytes\n        .unwrap_or_else(|| gradient_reserve_memory_bytes(opts.total_memory_bytes));\n\n    // Should have at least `MIN_SYSTEM_RESERVED_MEMORY_MB` for reserved memory.\n    let reserved = std::cmp::max(reserved, MIN_SYSTEM_RESERVED_MEMORY_MB << 20);\n\n    if reserved >= opts.total_memory_bytes {\n        panic!(\n            \"reserved memory ({}) >= total memory ({}).\",\n            convert(reserved as _),","sourceCodeStart":36,"sourceCodeEnd":72,"githubUrl":"https://github.com/risingwavelabs/risingwave/blob/6469eb736d691e8e9b8a419a57edd6429ca77417/src/compute/src/memory/config.rs#L36-L72","documentation":"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.","triggerScenarios":"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.","commonSituations":"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.","solutions":["Increase total_memory_bytes (or the container memory limit) to at least MIN_COMPUTE_MEMORY_MB MB.","Remove an overly small explicit --total-memory-bytes flag and let RisingWave derive it from the environment.","Check MIN_COMPUTE_MEMORY_MB in src/compute/src/memory/config.rs for the current minimum and size the deployment accordingly."],"exampleFix":"// before\n--total-memory-bytes 104857600  # 100MB, below minimum\n// after\n--total-memory-bytes 2147483648  # 2GB, above MIN_COMPUTE_MEMORY_MB","handlingStrategy":"validation","validationCode":"# Ensure container/config memory meets the compute-node minimum\nmin_mb = 512  # check MIN_COMPUTE_MEMORY_MB in src/compute/src/memory/config.rs\nlimit_mb = int(open('/sys/fs/cgroup/memory/memory.limit_in_bytes').read()) // (1024*1024)\nassert limit_mb >= min_mb, f'container memory {limit_mb}MB below minimum {min_mb}MB'","typeGuard":null,"tryCatchPattern":null,"preventionTips":["Set container memory limits well above MIN_COMPUTE_MEMORY_MB.","Do not set total_memory_bytes explicitly when running small dev/test environments.","Re-check minimums when upgrading, as MIN_COMPUTE_MEMORY_MB may change between releases."],"tags":["rust","memory","config","compute-node","startup"],"backgroundTag":"value-out-of-range","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"}