cloudflare/pingora · error · std::io::Error

dial9 max_file_size must be less than or equal to max_total_

Error message

dial9 max_file_size must be less than or equal to max_total_size

What it means

build_dial9_runtime() (pingora-runtime/src/lib.rs:331) requires max_file_size <= max_total_size: a single rotating trace file must always fit inside the total trace budget. If the per-file cap exceeds the total, runtime construction returns ErrorKind::InvalidInput with 'dial9 max_file_size must be less than or equal to max_total_size'.

Source

Thrown at pingora-runtime/src/lib.rs:331

    dial9_tokio_telemetry::telemetry::TelemetryGuard,
)> {
    use dial9_tokio_telemetry::telemetry::{RotatingWriter, TracedRuntime};
    use std::io::{Error, ErrorKind};

    if opts.max_file_size == 0 {
        return Err(Error::new(
            ErrorKind::InvalidInput,
            "dial9 max_file_size must be greater than zero",
        ));
    }
    if opts.max_total_size == 0 {
        return Err(Error::new(
            ErrorKind::InvalidInput,
            "dial9 max_total_size must be greater than zero",
        ));
    }
    if opts.max_file_size > opts.max_total_size {
        return Err(Error::new(
            ErrorKind::InvalidInput,
            "dial9 max_file_size must be less than or equal to max_total_size",
        ));
    }
    if opts.worker_poll_interval == Some(Duration::ZERO) {
        return Err(Error::new(
            ErrorKind::InvalidInput,
            "dial9 worker_poll_interval must be greater than zero",
        ));
    }

    if let Some(parent) = opts.trace_path.parent() {
        std::fs::create_dir_all(parent)?;
    }

    let writer = RotatingWriter::builder()
        .base_path(opts.trace_path.clone())
        .max_file_size(opts.max_file_size)

View on GitHub (pinned to 0046038bd4)

Solutions

  1. Raise max_total_size to at least max_file_size (preferably a multiple covering several rotation generations)
  2. Define the two values from one source, e.g. total = file_size * N_FILES, so they can never invert
  3. Add a config sanity test that fails when file > total

Example fix

// before
let opts = Dial9RuntimeOpts { max_file_size: 4 << 30, max_total_size: 1 << 30, ..Default::default() };

// after
let opts = Dial9RuntimeOpts { max_file_size: 64 << 20, max_total_size: 4 << 30, ..Default::default() };
Defensive patterns

Strategy: validation

Validate before calling

if opts.max_file_size > opts.max_total_size {
    return Err(std::io::Error::new(std::io::ErrorKind::InvalidInput,
        format!("per-file {} exceeds total {}", opts.max_file_size, opts.max_total_size)));
}

Prevention

When it happens

Trigger: Dial9RuntimeOpts where max_file_size > max_total_size, e.g. per-file 2 GiB with a 1 GiB total budget; usually a units mismatch (MiB vs GiB) or independent edits of two config keys.

Common situations: Tuning the per-file size without re-tuning the total; config defaults where the file size was raised over time but the budget stayed; unit confusion between binary and decimal multipliers.

Related errors


AI-assisted analysis of cloudflare/pingora@0046038bd4 (2026-08-16). Data as JSON: /api/errors/e2731877eb5bff2b. Report an issue: GitHub.