{"record":{"id":"7aa246372c83fdc3","repo":"jlcodes99/cockpit-tools","slug":"wakeupgateway-accept","errorCode":null,"errorMessage":"[WakeupGateway] accept 失败，网关停止: {}","messagePattern":"\\[WakeupGateway\\] accept 失败，网关停止: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"error","filePath":"crates/cockpit-core/src/modules/wakeup_gateway.rs","lineNumber":1717,"sourceCode":"        match listener.accept().await {\n            Ok((stream, _addr)) => {\n                let acceptor = tls_acceptor.clone();\n                tokio::spawn(async move {\n                    match acceptor.accept(stream).await {\n                        Ok(tls_stream) => {\n                            handle_connection(tls_stream).await;\n                        }\n                        Err(err) => {\n                            crate::modules::logger::log_error(&format!(\n                                \"[WakeupGateway] TLS 握手失败: {}\",\n                                err\n                            ));\n                        }\n                    }\n                });\n            }\n            Err(err) => {\n                crate::modules::logger::log_error(&format!(\n                    \"[WakeupGateway] accept 失败，网关停止: {}\",\n                    err\n                ));\n                break;\n            }\n        }\n    }\n}\n\npub async fn ensure_local_gateway_started() -> Result<String, String> {\n    let store = local_gateway_store();\n    {\n        let guard = store.lock().await;\n        if let Some(base_url) = guard.as_ref() {\n            return Ok(base_url.clone());\n        }\n    }\n","sourceCodeStart":1699,"sourceCodeEnd":1735,"githubUrl":"https://github.com/jlcodes99/cockpit-tools/blob/1ed8b77992d62ca81fabf744deb0839ad361d5bf/crates/cockpit-core/src/modules/wakeup_gateway.rs#L1699-L1735","documentation":"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.","triggerScenarios":"Thrown at crates/cockpit-core/src/modules/wakeup_gateway.rs:1717 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Check the interpolated OS error: EMFILE/ENFILE means fd limits must be raised; EBADF means the listener was closed","Restart the gateway/app to recreate the listener after resource exhaustion","Distinguish from per-connection TLS handshake errors, which do not stop the loop"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"1ed8b77992d62ca81fabf744deb0839ad361d5bf","analyzedAt":"2026-09-05T09:51:41.178Z","contentChangedAt":"2026-09-05T09:51:41.178Z","schemaVersion":2},"datasetVersion":"2026-09-12T12:17:11.808Z"}