{"record":{"id":"c8a20aab19edfec5","repo":"apache/seatunnel","slug":"failed-to-close-edge-socket-server-socket-on","errorCode":null,"errorMessage":"Failed to close edge socket server socket on {}:{}","messagePattern":"Failed to close edge socket server socket on (.+?):(.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-edge-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/edgesocket/source/EdgeSocketIngressServer.java","lineNumber":148,"sourceCode":"                }\n            }\n        }\n    }\n\n    private void closeServerSocket() throws IOException {\n        ServerSocket current = serverSocket;\n        serverSocket = null;\n        if (current != null) {\n            current.close();\n        }\n    }\n\n    private void closeServerSocketQuietly() {\n        try {\n            closeServerSocket();\n        } catch (IOException e) {\n            log.warn(\n                    \"Failed to close edge socket server socket on {}:{}\",\n                    \"0.0.0.0\",\n                    config.getPort(),\n                    e);\n        }\n    }\n\n    private void receiveLoop() {\n        while (isReceiverActive()) {\n            try {\n                openServerSocketWithRetry();\n                if (!isReceiverActive()) {\n                    return;\n                }\n                serveOneCollector();\n            } catch (SocketTimeoutException ignored) {\n            } catch (Exception e) {\n                if (shouldExitOnException(e)) {\n                    return;","sourceCodeStart":130,"sourceCodeEnd":166,"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#L130-L166","documentation":"Warned by closeServerSocketQuietly() when closing the server socket during the retry/open path throws an IOException. The method is intentionally 'quiet' — it logs and continues rather than propagating — typically while giving up on a partially opened socket between retries.","triggerScenarios":"closeServerSocket() throws IOException during closeServerSocketQuietly(), usually called from openServerSocketWithRetry() after a failed or superseded bind attempt.","commonSituations":"Socket already closed by the OS or another thread (double-close), port in a half-open state after bind failure, resource exhaustion in containers with low fd limits.","solutions":["Verify single ownership of the server socket — only one thread closes it.","Check file-descriptor limits in the deployment environment (ulimit / container limits).","Confirm the port is not contended by another process (address-already-in-use during the retry loop).","Treat as benign if it follows a bind failure, but fix double-close if it appears during normal shutdown."],"exampleFix":"// before\n// close called from both stop() and openServerSocketWithRetry retry path\n// after\nif (serverSocket != null && !serverSocket.isClosed()) { serverSocket.close(); }","handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"try { server.start(); } catch (IOException e) { log.warn(\"server open failed; port state: {}\", e.getMessage()); } // close failures after this are benign","preventionTips":["Close the server socket in exactly one place (a single owner/finally block)","Check isClosed() before closing","Raise fd limits in containers (ulimit -n) for high-churn sockets"],"tags":["network","socket","resource-cleanup"],"backgroundTag":"broken-pipe","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"}