{"record":{"id":"410cac8239321406","repo":"linera-io/linera-protocol","slug":"admin-http-server-exited-unexpectedly-result","errorCode":null,"errorMessage":"Admin HTTP server exited unexpectedly: {result:?}","messagePattern":"Admin HTTP server exited unexpectedly: (.+?)","errorType":"exception","errorClass":null,"httpStatus":null,"severity":"critical","filePath":"linera-bridge/src/relay/mod.rs","lineNumber":520,"sourceCode":"    loop {\n        tokio::select! {\n            result = &mut chain_listener_handle => {\n                anyhow::bail!(\"Chain listener exited unexpectedly: {result:?}\");\n            }\n            result = &mut evm_scan_handle => {\n                anyhow::bail!(\"EVM scan loop exited unexpectedly: {result:?}\");\n            }\n            result = &mut linera_scan_handle => {\n                anyhow::bail!(\"Linera scan loop exited unexpectedly: {result:?}\");\n            }\n            result = &mut retry_handle => {\n                anyhow::bail!(\"Retry loop exited unexpectedly: {result:?}\");\n            }\n            result = &mut http_server_handle => {\n                anyhow::bail!(\"HTTP server exited unexpectedly: {result:?}\");\n            }\n            result = &mut admin_server_handle => {\n                anyhow::bail!(\"Admin HTTP server exited unexpectedly: {result:?}\");\n            }\n            _ = inbox_drain_interval.tick() => {\n                // Periodic safety net for a missed `NewIncomingBundle`: sync and\n                // drain the inbox so stranded messages (e.g. user burns) are\n                // eventually processed even without a fresh notification.\n                if let Err(e) = chain_client.synchronize_from_validators().await {\n                    tracing::warn!(\"Periodic sync before inbox drain failed: {e}\");\n                } else {\n                    match chain_client.process_inbox().await {\n                        Ok((certs, _)) if !certs.is_empty() => {\n                            tracing::info!(count = certs.len(), \"Periodic inbox drain processed messages\");\n                        }\n                        Ok(_) => {}\n                        Err(e) => tracing::warn!(\"Periodic inbox drain failed: {e}\"),\n                    }\n                }\n            }\n            notification = notifications.next() => {","sourceCodeStart":502,"sourceCodeEnd":538,"githubUrl":"https://github.com/linera-io/linera-protocol/blob/6c226ddcb332ef55118dc8d0aafbd093d5420899/linera-bridge/src/relay/mod.rs#L502-L538","documentation":"In serve_loop's tokio::select!, the admin HTTP server task exited. The relay binds a separate admin endpoint on 127.0.0.1:{admin_port} (axum::serve with .context(\"Admin HTTP server error\")); if that task stops for any reason, serve_loop fails fast and the entire relay exits.","triggerScenarios":"The admin axum server returns an io error at runtime, or the task panics inside an admin handler. Bind-time port conflicts on the admin port normally fail earlier during TcpListener::bind, so an exit here means a runtime socket error or handler panic.","commonSituations":"Admin port colliding with a rebinding process after runtime starts; a panic in an admin endpoint handler when queried with unexpected input; socket loss after container network reconfiguration.","solutions":["Look for the preceding \"Admin HTTP server error\" log line — it carries the underlying io error.","Ensure the admin port is exclusively owned by the relay (check ss -ltnp) and not grabbed by a sidecar or second relay instance.","Fix any panicking admin handler (validate/guard admin request payloads).","Restart the relay via its supervisor; consider making the admin server optional if your deployment does not use it."],"exampleFix":"// before\nresult = &mut admin_server_handle => {\n    anyhow::bail!(\"Admin HTTP server exited unexpectedly: {result:?}\");\n}\n\n// after: preserve the inner error\nresult = &mut admin_server_handle => {\n    let inner = result.unwrap_or_else(|join| Err(anyhow::anyhow!(\"join error: {join}\")));\n    anyhow::bail!(\"Admin HTTP server exited unexpectedly: {inner:?}\");\n}","handlingStrategy":"retry","validationCode":"// Pre-flight: bind the admin listener before spawn (already done); optionally probe\n// 127.0.0.1:{admin_port} is free before relay start to fail fast on conflicts.","typeGuard":null,"tryCatchPattern":"// Fatal by design; restart the process. The inner context \"Admin HTTP server error\" names the io cause.","preventionTips":["Reserve the admin port for the relay in deployment config.","Keep admin handlers total (no panics) and validate request payloads."],"tags":["linera-bridge","relay","http-server","admin","task-supervision","tokio","rust"],"backgroundTag":"background-task-exited","analyzedSha":"6c226ddcb332ef55118dc8d0aafbd093d5420899","analyzedAt":"2026-08-22T22:49:09.787Z","schemaVersion":2},"datasetVersion":"2026-08-23T01:17:44.959Z"}