{"record":{"id":"84752472e8a72703","repo":"apache/seatunnel","slug":"source-reopen-exhausted","errorCode":"SOURCE_REOPEN_EXHAUSTED","errorMessage":"Bind edge socket ingress 0.0.0.0:%s failed after exhausting retries","messagePattern":"Bind edge socket ingress 0\\.0\\.0\\.0:(.+?) failed after exhausting retries","errorType":"error_code","errorClass":"EdgeSocketConnectorException","httpStatus":null,"severity":"critical","filePath":"seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketIngressServer.java","lineNumber":120,"sourceCode":"        int attempt = 1;\n        while (isReceiverActive()) {\n            try {\n                serverSocket = new ServerSocket();\n                serverSocket.setReuseAddress(true);\n                serverSocket.bind(new InetSocketAddress(config.getPort()));\n                serverSocket.setSoTimeout(config.getAcceptTimeoutMs());\n                remainingOpenRetries = config.getMaxNumRetries();\n                log.info(\n                        \"Edge socket ingress started, bind host:[{}], port:[{}], endpoint:[{}], attempt:[{}]\",\n                        \"0.0.0.0\",\n                        config.getPort(),\n                        config.getEndpoint(),\n                        attempt);\n                return;\n            } catch (IOException bindException) {\n                closeServerSocketQuietly();\n                if (!tryConsumeRetryBudget(bindException)) {\n                    throw new EdgeSocketConnectorException(\n                            EdgeSocketConnectorErrorCode.SOURCE_REOPEN_EXHAUSTED,\n                            String.format(\n                                    \"Bind edge socket ingress %s:%s failed after exhausting retries\",\n                                    \"0.0.0.0\", config.getPort()),\n                            bindException);\n                }\n                attempt++;\n                if (isInterruptedDuringRetryWait()) {\n                    return;\n                }\n            }\n        }\n    }\n\n    private void closeServerSocket() throws IOException {\n        ServerSocket current = serverSocket;\n        serverSocket = null;\n        if (current != null) {","sourceCodeStart":102,"sourceCodeEnd":138,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketIngressServer.java#L102-L138","documentation":"The edge-socket ingress server could not bind its listening socket on 0.0.0.0:<port> and exhausted its retry budget. Each bind attempt's IOException is consumed against a limited retry budget; once the budget is empty, receiveLoop throws SOURCE_REOPEN_EXHAUSTED. This fails the source because without a bound server socket no data can be received.","triggerScenarios":"openServerSocketWithRetry (called from receiveLoop) repeatedly fails to bind because the port is already in use, the address is unavailable, or permissions are missing, until tryConsumeRetryBudget returns false.","commonSituations":"Another instance of the job (or a stale process) already holds the port; port conflicts with a system service; running in a container where 0.0.0.0 binding is restricted; rapid job restart before the OS releases the socket (TIME_WAIT).","solutions":["Check what occupies the port (netstat/ss/lsof) and stop it or change config port to a free one.","Ensure no duplicate/stale edge-socket job instance is still running and holding the socket.","Wait for the OS to release the socket after a restart, or enable SO_REUSEADDR semantics / lower restart rate.","Verify the runtime environment allows binding on 0.0.0.0 (container network, security policies, privileged ports <1024 need privileges)."],"exampleFix":"// before\nport = 5100 // already used by another process\n// after\nport = 15210 // free port, or stop the conflicting process","handlingStrategy":"retry","validationCode":"// before starting the job\nSocket s = new Socket();\nboolean free = true;\ntry { s.bind(new InetSocketAddress(0, config.getPort())); } catch (IOException e) { free = false; } finally { s.close(); }\nif (!free) throw new IllegalStateException(\"port \" + config.getPort() + \" already in use\");","typeGuard":null,"tryCatchPattern":"try {\n    source.open();\n} catch (EdgeSocketConnectorException e) {\n    if (e.getCode() == SOURCE_REOPEN_EXHAUSTED) {\n        log.error(\"bind failed repeatedly; port likely in use\", e);\n        // alert operator or switch to a fallback port from config\n    }\n}","preventionTips":["Reserve dedicated, documented ports for edge-socket ingress per node.","Use process supervision to prevent duplicate/stale job instances holding ports.","Check for conflicting services before deployment (ss -ltnp).","In containers, publish/map the port explicitly and avoid privileged port ranges."],"tags":["network","bind","port-in-use","socket"],"backgroundTag":"address-already-in-use","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}