{"record":{"id":"8f619eccb8655542","repo":"apache/seatunnel","slug":"socket-write-failed","errorCode":"SOCKET_WRITE_FAILED","errorMessage":"unable to write; interrupted while doing another attempt","messagePattern":"unable to write; interrupted while doing another attempt","errorType":"error_code","errorClass":"SocketConnectorException","httpStatus":null,"severity":"error","filePath":"seatunnel-connectors-v2/connector-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/socket/sink/SocketClient.java","lineNumber":136,"sourceCode":"                    retries++;\n\n                    try {\n                        // initialize a new connection\n                        createConnection();\n                        outputStream.write(msg);\n                        return;\n                    } catch (IOException ee) {\n                        lastException = ee;\n                        log.error(\n                                \"Re-connect to socket server and send message failed. Retry time(s): {}\",\n                                retries,\n                                ee);\n                    }\n                    try {\n                        this.wait(CONNECTION_RETRY_DELAY);\n                    } catch (InterruptedException ex) {\n                        Thread.currentThread().interrupt();\n                        throw new SocketConnectorException(\n                                SocketConnectorErrorCode.SOCKET_WRITE_FAILED,\n                                \"unable to write; interrupted while doing another attempt\",\n                                e);\n                    }\n                }\n\n                if (isRunning) {\n                    throw new SocketConnectorException(\n                            SocketConnectorErrorCode.SEND_MESSAGE_TO_SOCKET_SERVER_FAILED,\n                            String.format(\n                                    \"Failed to send message '%s' to socket server at %s:%d. Failed after %d retries.\",\n                                    row, hostName, port, retries),\n                            lastException);\n                }\n            }\n        }\n    }\n","sourceCodeStart":118,"sourceCodeEnd":154,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/socket/sink/SocketClient.java#L118-L154","documentation":"This error is raised by SocketClient.write after exhausting all reconnect attempts: the thread waiting between retries was interrupted, so no more attempts can be made and the message could not be delivered to the socket server. It fires when the sink's retry loop is interrupted (usually by job cancellation or shutdown) while the connection to the socket server keeps failing; it surfaces as an InterruptedException/UncheckedIOException rather than a network error.","triggerScenarios":"Thrown at seatunnel-connectors-v2/connector-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/socket/sink/SocketClient.java:136 when the library encounters an invalid state.","commonSituations":"See trigger scenarios.","solutions":["Treat as task shutdown: check whether the job was cancelled and propagate interruption cleanly","Ensure the socket server stays available so reconnect attempts succeed before interruption","Reduce write backpressure so the retry loop is not left waiting indefinitely"],"exampleFix":null,"handlingStrategy":"retry","validationCode":null,"typeGuard":null,"tryCatchPattern":null,"preventionTips":[],"tags":[],"backgroundTag":null,"analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}