risingwavelabs/risingwave · warning · DashboardError
CPU profiling duration must be greater than zero
Error message
CPU profiling duration must be greater than zero
What it means
The dashboard `cpu_profile` handler validates that the requested profiling `duration_secs` path parameter is strictly greater than zero. A zero-second profile is meaningless (no samples could be collected), so the request is rejected before starting the profiler on the worker.
Solutions
- Pass a positive duration in seconds, e.g. /api/v1/cpu_profile/1/10 for a 10-second profile.
- Guard the calling script: skip the request when the computed duration is <= 0.
- Check the URL path segments are in the right order — worker_id first, duration second.
Example fix
// before curl http://localhost:5691/api/v1/cpu_profile/1/0 // after curl http://localhost:5691/api/v1/cpu_profile/1/15
Defensive patterns
Strategy: validation
Validate before calling
const duration = Number(opts.durationSecs);
if (!Number.isInteger(duration) || duration <= 0) throw new Error('CPU profiling duration must be a positive integer of seconds'); Type guard
function isValidDurationSecs(n) { return Number.isInteger(n) && n > 0; } Try / catch
try { const res = await fetch(`/api/v1/cpu_profile/${workerId}/${duration}`); if (!res.ok) throw new Error(await res.text()); } catch (e) { /* surface duration validation to the user */ } Prevention
- Default the profiling duration to a sane value (e.g. 10s) when unset.
- Clamp or reject non-positive durations at the tooling boundary before calling the API.
When it happens
Trigger: Calling GET /api/v1/cpu_profile/{worker_id}/{duration_secs} with duration_secs=0, e.g. `curl http://localhost:5691/api/v1/cpu_profile/1/0`.
Common situations: Templated scripts computing a duration from an empty/unset variable so it defaults to 0; automated tooling that divides a budget into zero-second slices; hand-typed URLs testing the endpoint.
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
- config error
- Invalid value for Bounded strategy: must be positive integer
- unrecognized configs
- Unsupported actor_traces_format
- Unsupported format ` `, only `text` and `json` are…
AI-assisted analysis of risingwavelabs/risingwave@6469eb736d (2026-09-11).
Data as JSON: /api/errors/bd280294496a0754.
Report an issue: GitHub.
Appendix: source
Thrown at src/meta/src/dashboard/mod.rs:570
.get_worker_by_id(worker_id)
.await
.map_err(err)?
.context("worker node not found")
.map_err(err)?;
let client = srv.monitor_clients.get(&worker_node).await.map_err(err)?;
let result = client.heap_profile("".to_owned()).await.map_err(err)?;
Ok(result.into())
}
pub async fn cpu_profile(
Path((worker_id, duration_secs)): Path<(WorkerId, u64)>,
Extension(srv): Extension<Service>,
) -> Result<Response> {
if duration_secs == 0 {
return Err(err(anyhow!(
"CPU profiling duration must be greater than zero"
)));
}
let flamegraph = if worker_id == crate::manager::META_NODE_ID {
srv.profile_service
.profiling(Request::new(ProfilingRequest {
sleep_s: duration_secs,
}))
.await
.map_err(err)?
.into_inner()
.result
} else {
let worker_node = srv
.metadata_manager
.get_worker_by_id(worker_id)
.awaitView on GitHub (pinned to 6469eb736d)