ruvnet/RuView · error

HTTP server error: {e}

Error message

HTTP server error: {e}

What it means

axum::serve returned an error after the HTTP API had already started, wrapped as 'HTTP server error' in calibrate_api.rs:368. This is a runtime accept-loop/connection failure on the bound TcpListener — for example file-descriptor exhaustion (EMFILE) or the listener being invalidated — not the startup bind failure, which is reported separately.

Source

Thrown at v2/crates/wifi-densepose-cli/src/calibrate_api.rs:368

    if let Some(token) = args.token.clone() {
        app = app.layer(axum::middleware::from_fn_with_state(token, require_bearer));
        eprintln!("[calibrate-serve] bearer auth ENABLED");
    } else if args.http_bind != "127.0.0.1" && args.http_bind != "localhost" {
        eprintln!(
            "[calibrate-serve] WARNING: bound to {} with NO --token — anyone on the network can drive calibration",
            args.http_bind
        );
    }

    let http_addr = format!("{}:{}", args.http_bind, args.http_port);
    let listener = tokio::net::TcpListener::bind(&http_addr)
        .await
        .map_err(|e| anyhow::anyhow!("cannot bind HTTP listener on {http_addr}: {e}"))?;
    eprintln!("[calibrate-serve] HTTP API on http://{http_addr}  (GET / for the route list)");

    axum::serve(listener, app)
        .await
        .map_err(|e| anyhow::anyhow!("HTTP server error: {e}"))?;
    Ok(())
}

// ---------------------------------------------------------------------------
// Ingest task — owns the UDP socket and the optional active recorder
// ---------------------------------------------------------------------------

struct ActiveSession {
    recorder: CalibrationRecorder,
    room_id: String,
    tier: String,
    started: Instant,
    deadline: Instant,
    target_frames: usize,
    z_median: f32,
    z_max: f32,
    motion_flagged: bool,
}

View on GitHub (pinned to 4685618388)

Solutions

  1. Read the {e} payload: EMFILE/ENFILE points at fd limits — raise ulimit -n or systemd LimitNOFILE
  2. Restart the service; an accept error after Ctrl-C shutdown is expected noise and safe to ignore
  3. Reduce concurrent clients or front the API with a reverse proxy that caps connections
  4. If it recurs under load, capture ss -tlnp output and tokio runtime logs at failure time
Defensive patterns

Strategy: try-catch

Try / catch

if let Err(e) = axum::serve(listener, app).await {
    eprintln!("[calibrate-serve] HTTP server error: {e}");
    // EMFILE/ENFILE: raise fd limits and restart; post-shutdown errors: benign
}

Prevention

When it happens

Trigger: File-descriptor limits reached under many concurrent connections; abnormal teardown of the tokio runtime while serving; socket option failures on accepted connections.

Common situations: Long-running serve processes hitting ulimit -n; supervisors killing the process so the listener drops mid-accept; constrained container network stacks.

Related errors


AI-assisted analysis of ruvnet/RuView@4685618388 (2026-08-16). Data as JSON: /api/errors/c7f90d22eb801358. Report an issue: GitHub.