apache/seatunnel · error · ClickhouseConnectorException
Failed to close ssh client
Error message
Failed to close ssh client
What it means
ScpFileTransfer.close() wraps an IOException from sshClient.close() (after stop()) into SSH_OPERATION_FAILED with 'Failed to close ssh client'. Thrown during sink lifecycle shutdown when the SSH client teardown fails.
Source
Thrown at seatunnel-connectors-v2/connector-clickhouse/src/main/java/org/apache/seatunnel/connectors/seatunnel/clickhouse/sink/file/ScpFileTransfer.java:152
@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
- Look for the first/underlying SSH error in the logs; this is typically a follow-on failure
- Avoid double-closing the transfer (check retry/cancel handling)
- Ensure the worker has enough threads/resources for the SSH client
- Retry the job and verify host connectivity
Defensive patterns
Strategy: try-catch
Try / catch
try {
transfer.close();
} catch (ClickhouseConnectorException e) {
log.warn("SSH client close failed during shutdown; treating as non-fatal", e);
} Prevention
- Treat close failures as secondary symptoms; fix the root SSH failure
- Guard against concurrent/double close during job cancel
- Keep worker resources (threads) sufficient for SSH client teardown
When it happens
Trigger: close() reaches sshClient.close() and it throws — usually a secondary symptom of an earlier connection failure, double-close from a concurrent cancel, or IO threads unable to shut down cleanly.
Common situations: Job cancellation racing sink close, prior SCP failure leaving the client broken, or thread/resource exhaustion on the SeaTunnel worker.
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/70249631ba1c98c2.
Report an issue: GitHub.