jlcodes99/cockpit-tools · error

[WakeupGateway] accept 失败,网关停止: {}

Error message

[WakeupGateway] accept 失败,网关停止: {}

What it means

Fatal accept-loop guard in the wakeup gateway TLS listener: listener.accept() itself failed (as opposed to a per-connection TLS handshake failure, which is only logged). The message '[WakeupGateway] accept 失败,网关停止: {}' marks that the gateway accept loop terminates — typically due to the listener socket being closed, EMFILE/fd exhaustion, or shutdown — so the gateway stops serving connections.

Source

Thrown at crates/cockpit-core/src/modules/wakeup_gateway.rs:1717

        match listener.accept().await {
            Ok((stream, _addr)) => {
                let acceptor = tls_acceptor.clone();
                tokio::spawn(async move {
                    match acceptor.accept(stream).await {
                        Ok(tls_stream) => {
                            handle_connection(tls_stream).await;
                        }
                        Err(err) => {
                            crate::modules::logger::log_error(&format!(
                                "[WakeupGateway] TLS 握手失败: {}",
                                err
                            ));
                        }
                    }
                });
            }
            Err(err) => {
                crate::modules::logger::log_error(&format!(
                    "[WakeupGateway] accept 失败,网关停止: {}",
                    err
                ));
                break;
            }
        }
    }
}

pub async fn ensure_local_gateway_started() -> Result<String, String> {
    let store = local_gateway_store();
    {
        let guard = store.lock().await;
        if let Some(base_url) = guard.as_ref() {
            return Ok(base_url.clone());
        }
    }

View on GitHub (pinned to 1ed8b77992)

Solutions

  1. Check the interpolated OS error: EMFILE/ENFILE means fd limits must be raised; EBADF means the listener was closed
  2. Restart the gateway/app to recreate the listener after resource exhaustion
  3. Distinguish from per-connection TLS handshake errors, which do not stop the loop
Defensive patterns

Strategy: try-catch

When it happens

Trigger: Thrown at crates/cockpit-core/src/modules/wakeup_gateway.rs:1717 when the library encounters an invalid state.

Common situations: See trigger scenarios.


AI-assisted analysis of jlcodes99/cockpit-tools@1ed8b77992 (2026-09-05). Data as JSON: /api/errors/7aa246372c83fdc3. Report an issue: GitHub.