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

  1. Check for earlier SSH errors in the log; this is usually a secondary symptom of an earlier failure
  2. Ensure the sink is not closed twice concurrently (check job retry/cancel logic)
  3. Confirm adequate thread resources for the SSH client's IO threads on the worker
  4. 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

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


AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10). Data as JSON: /api/errors/153e97f0da8e3b3b. Report an issue: GitHub.