apache/seatunnel · error · SocketConnectorException
SOCKET_WRITE_FAILED
SOCKET_WRITE_FAILED
Error message
unable to write; interrupted while doing another attempt
What it means
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.
Source
Thrown at seatunnel-connectors-v2/connector-socket/src/main/java/org/apache/seatunnel/connectors/seatunnel/socket/sink/SocketClient.java:136
retries++;
try {
// initialize a new connection
createConnection();
outputStream.write(msg);
return;
} catch (IOException ee) {
lastException = ee;
log.error(
"Re-connect to socket server and send message failed. Retry time(s): {}",
retries,
ee);
}
try {
this.wait(CONNECTION_RETRY_DELAY);
} catch (InterruptedException ex) {
Thread.currentThread().interrupt();
throw new SocketConnectorException(
SocketConnectorErrorCode.SOCKET_WRITE_FAILED,
"unable to write; interrupted while doing another attempt",
e);
}
}
if (isRunning) {
throw new SocketConnectorException(
SocketConnectorErrorCode.SEND_MESSAGE_TO_SOCKET_SERVER_FAILED,
String.format(
"Failed to send message '%s' to socket server at %s:%d. Failed after %d retries.",
row, hostName, port, retries),
lastException);
}
}
}
}
View on GitHub (pinned to cf67b549a7)
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
Defensive patterns
Strategy: retry
When it happens
Trigger: 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.
Common situations: See trigger scenarios.
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/8f619eccb8655542.
Report an issue: GitHub.