{"record":{"id":"c7f90d22eb801358","repo":"ruvnet/RuView","slug":"http-server-error-e","errorCode":null,"errorMessage":"HTTP server error: {e}","messagePattern":"HTTP server error: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"error","filePath":"v2/crates/wifi-densepose-cli/src/calibrate_api.rs","lineNumber":368,"sourceCode":"    if let Some(token) = args.token.clone() {\n        app = app.layer(axum::middleware::from_fn_with_state(token, require_bearer));\n        eprintln!(\"[calibrate-serve] bearer auth ENABLED\");\n    } else if args.http_bind != \"127.0.0.1\" && args.http_bind != \"localhost\" {\n        eprintln!(\n            \"[calibrate-serve] WARNING: bound to {} with NO --token — anyone on the network can drive calibration\",\n            args.http_bind\n        );\n    }\n\n    let http_addr = format!(\"{}:{}\", args.http_bind, args.http_port);\n    let listener = tokio::net::TcpListener::bind(&http_addr)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"cannot bind HTTP listener on {http_addr}: {e}\"))?;\n    eprintln!(\"[calibrate-serve] HTTP API on http://{http_addr}  (GET / for the route list)\");\n\n    axum::serve(listener, app)\n        .await\n        .map_err(|e| anyhow::anyhow!(\"HTTP server error: {e}\"))?;\n    Ok(())\n}\n\n// ---------------------------------------------------------------------------\n// Ingest task — owns the UDP socket and the optional active recorder\n// ---------------------------------------------------------------------------\n\nstruct ActiveSession {\n    recorder: CalibrationRecorder,\n    room_id: String,\n    tier: String,\n    started: Instant,\n    deadline: Instant,\n    target_frames: usize,\n    z_median: f32,\n    z_max: f32,\n    motion_flagged: bool,\n}","sourceCodeStart":350,"sourceCodeEnd":386,"githubUrl":"https://github.com/ruvnet/RuView/blob/4685618388a5e49fad5b3005806f3bdd6a7c25c3/v2/crates/wifi-densepose-cli/src/calibrate_api.rs#L350-L386","documentation":"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.","triggerScenarios":"File-descriptor limits reached under many concurrent connections; abnormal teardown of the tokio runtime while serving; socket option failures on accepted connections.","commonSituations":"Long-running serve processes hitting ulimit -n; supervisors killing the process so the listener drops mid-accept; constrained container network stacks.","solutions":["Read the {e} payload: EMFILE/ENFILE points at fd limits — raise ulimit -n or systemd LimitNOFILE","Restart the service; an accept error after Ctrl-C shutdown is expected noise and safe to ignore","Reduce concurrent clients or front the API with a reverse proxy that caps connections","If it recurs under load, capture ss -tlnp output and tokio runtime logs at failure time"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"if let Err(e) = axum::serve(listener, app).await {\n    eprintln!(\"[calibrate-serve] HTTP server error: {e}\");\n    // EMFILE/ENFILE: raise fd limits and restart; post-shutdown errors: benign\n}","preventionTips":["Raise fd limits (ulimit -n, systemd LimitNOFILE) for long-running serve processes","Front the API with a reverse proxy that enforces connection caps","Distinguish post-Ctrl-C shutdown errors from load-time failures before alerting"],"tags":["rust","http","axum","tokio","runtime"],"backgroundTag":null,"analyzedSha":"4685618388a5e49fad5b3005806f3bdd6a7c25c3","analyzedAt":"2026-08-16T06:09:40.886Z","schemaVersion":2},"datasetVersion":"2026-08-16T08:17:34.114Z"}