{"record":{"id":"0dbe620e1476827d","repo":"apache/seatunnel","slug":"cannot-connect-to-edge-ingress-endpoint-after","errorCode":null,"errorMessage":"Cannot connect to edge ingress ${endpoint} after ${maxReconnectCycles} cycles","messagePattern":"Cannot connect to edge ingress (.+?) after (.+?) cycles","errorType":"exception","errorClass":"IOException","httpStatus":null,"severity":"error","filePath":"seatunnel-edge-agent/seatunnel-edge-agent-transport/src/main/java/org/apache/seatunnel/edge/agent/transport/socket/EdgeTransportClient.java","lineNumber":194,"sourceCode":"                }\n                throw ex;\n            } catch (IOException connectOrAuthEx) {\n                if (socket != null) {\n                    try {\n                        socket.close();\n                    } catch (IOException closeEx) {\n                        LOG.debug(\"Error closing socket after connect/auth failure\", closeEx);\n                    }\n                }\n                LOG.warn(\"Connect/auth failed for {}\", endpoint, connectOrAuthEx);\n                backoff =\n                        Math.min(\n                                config.getMaxBackoffMs(),\n                                Math.max(backoff, config.getInitialBackoffMs()) * 2);\n                EdgeTransportConfig.sleepQuiet(backoff);\n            }\n        }\n        throw new IOException(\n                \"Cannot connect to edge ingress \"\n                        + endpoint\n                        + \" after \"\n                        + config.getMaxReconnectCycles()\n                        + \" cycles\");\n    }\n\n    private static final class SocketHolder implements AutoCloseable {\n        private final Socket socket;\n        private final BufferedReader reader;\n        private final BufferedWriter writer;\n\n        SocketHolder(Socket socket, BufferedReader reader, BufferedWriter writer) {\n            this.socket = socket;\n            this.reader = reader;\n            this.writer = writer;\n        }\n","sourceCodeStart":176,"sourceCodeEnd":212,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-edge-agent/seatunnel-edge-agent-transport/src/main/java/org/apache/seatunnel/edge/agent/transport/socket/EdgeTransportClient.java#L176-L212","documentation":"EdgeTransportClient.ensureAuthenticatedSession exhausts its bounded reconnect loop (maxReconnectCycles attempts with exponential backoff) without establishing an authenticated session to the edge ingress endpoint, then throws IOException. It fails fast instead of retrying forever when the ingress is unreachable or keeps rejecting the handshake.","triggerScenarios":"open() or sendUntilReceived() calls ensureAuthenticatedSession; every connect/auth attempt across maxReconnectCycles cycles fails (endpoint down, DNS failure, TLS rejection, auth rejected).","commonSituations":"Edge ingress not deployed or crashed; wrong endpoint host/port in agent config; network partition or firewall blocking the socket; credentials misconfigured so handshake auth never succeeds.","solutions":["Verify the edge ingress endpoint is reachable from the agent (curl/telnet host:port) and fix the endpoint config.","Check agent logs for the per-attempt failure reason (DNS, TLS, auth) and fix the root cause.","Increase initialBackoffMs/maxBackoffMs and maxReconnectCycles if the ingress is slow to start (rolling deploys).","Add an outer retry/fallback so the agent degrades gracefully instead of throwing a single IOException."],"exampleFix":"// before\nclient.open(); // throws IOException after maxReconnectCycles\n// after\ntry {\n    client.open();\n} catch (IOException e) {\n    LOG.warn(\"edge ingress unreachable, will retry in 30s\", e);\n    scheduler.schedule(client::open, 30, TimeUnit.SECONDS);\n}","handlingStrategy":"retry","validationCode":"boolean reachable = false;\ntry (Socket s = new Socket()) {\n    s.connect(new InetSocketAddress(host, port), 3000);\n    reachable = true;\n} catch (IOException ignored) {}\nif (!reachable) throw new IllegalStateException(\"edge ingress \" + host + \":\" + port + \" unreachable before open()\");","typeGuard":null,"tryCatchPattern":"try {\n    client.open();\n} catch (IOException e) {\n    LOG.log(Level.SEVERE, \"edge ingress connect failed after reconnect cycles\", e);\n    scheduleReconnectWithCap();\n}","preventionTips":["Health-check the ingress endpoint before opening the client.","Tune initialBackoffMs/maxBackoffMs and maxReconnectCycles for your deploy cadence.","Monitor auth rejections separately from connection failures.","Alert before agents exhaust reconnect cycles."],"tags":["network","websocket","reconnect"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}