apache/seatunnel · error · ClickhouseConnectorException
Failed to close ssh client
Error message
Failed to close ssh client
What it means
RsyncFileTransfer.close() wraps an IOException thrown while closing the SshClient itself (after stop()) into SSH_OPERATION_FAILED. The session may have closed fine but the underlying client teardown failed. It is thrown during sink lifecycle shutdown.
Source
Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/RsyncFileTransfer.java:191
@Override
public void close() {
if (clientSession != null && clientSession.isOpen()) {
try {
clientSession.close();
} catch (IOException e) {
throw new ClickhouseConnectorException(
ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,
"Failed to close ssh session",
e);
}
}
if (sshClient != null && sshClient.isOpen()) {
sshClient.stop();
try {
sshClient.close();
} catch (IOException e) {
throw new ClickhouseConnectorException(
ClickhouseConnectorErrorCode.SSH_OPERATION_FAILED,
"Failed to close ssh client",
e);
}
}
}
}
View on GitHub (pinned to cf67b549a7)
Solutions
- Check for earlier SSH errors in the log; this is usually a secondary symptom of an earlier failure
- Ensure the sink is not closed twice concurrently (check job retry/cancel logic)
- Confirm adequate thread resources for the SSH client's IO threads on the worker
- Retry the job; verify host connectivity and sshd health
Defensive patterns
Strategy: try-catch
Try / catch
try {
transfer.close();
} catch (ClickhouseConnectorException e) {
log.warn("Ignoring ssh client close failure during shutdown", e); // secondary symptom, don't mask root cause
} Prevention
- Check for an earlier root-cause SSH error before treating close failure as primary
- Avoid double-closing the transfer from concurrent cancel/retry paths
- Ensure worker has adequate threads for SSH IO
When it happens
Trigger: close() reaches sshClient.close() and it throws IOException — e.g. the client's executor/IO threads are wedged, or the client was already stopped/closed elsewhere and the underlying transport errors on shutdown.
Common situations: Job cancellation racing with sink close (double close), JVM thread pool exhaustion preventing sshd's NioWorker from shutting down, or an earlier SSH failure leaving the client in a broken state.
Related errors
- Failed to close ssh session
- Failed to close ssh session
- Failed to close ssh client
- Failed to connect to host: " + host + " by user: " + user +
- Failed to connect to host: " + host + " by user: " + user +
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/153e97f0da8e3b3b.
Report an issue: GitHub.