apache/seatunnel · warning

[Instance {}] Failed to clean up during abort: {}

Error message

[Instance {}] Failed to clean up during abort: {}

What it means

This is a warning logged by DatabendSinkAggregatedCommitter.abort() when an exception is thrown while rolling back/aborting a transaction. The committer attempts to roll back the current Databend connection/transaction so partially written data from a failed checkpoint is discarded; if that cleanup itself throws, the original failure is not masked — only a warning is emitted. Because abort is best-effort during failure handling, the exception is logged at WARN and swallowed.

Source

Thrown at seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/sink/DatabendSinkAggregatedCommitter.java:237

        return new DatabendSinkAggregatedCommitInfo(commitInfos, null, null);
    }

    @Override
    public void abort(List<DatabendSinkAggregatedCommitInfo> aggregatedCommitInfos)
            throws IOException {
        aborted = true;
        // In case of abort, we might want to clean up the raw table and stream
        log.info("[Instance {}] Aborting Databend sink operations", instanceId);
        try {
            if (isCdcMode && connection != null && !connection.isClosed()) {
                // In the new approach, raw table and stream names are not stored in this class
                // Cleanup would need to be handled differently or at the DatabendSink level
                log.info(
                        "[Instance {}] CDC mode abort - cleanup handled at DatabendSink level",
                        instanceId);
            }
        } catch (Exception e) {
            log.warn(
                    "[Instance {}] Failed to clean up during abort: {}",
                    instanceId,
                    e.getMessage(),
                    e);
        }
    }

    @Override
    public void close() throws IOException {
        Exception closeException = null;
        try {
            if (!aborted && isCdcMode && connection != null && !connection.isClosed()) {
                try {
                    log.info("[Instance {}] Performing final merge before closing", instanceId);
                    performMerge();
                } catch (Exception mergeEx) {
                    log.error(
                            "[Instance {}] Final merge failed, will still close connection: {}",

View on GitHub (pinned to cf67b549a7)

Solutions

  1. Check Databend connectivity and connection timeout settings to keep the connection alive until abort
  2. Verify credentials and that the Databend user has rights to roll back the active transaction
  3. Inspect the full stack trace attached to the warning to find the underlying cause and fix it; abort failure does not fail the job itself
  4. If data duplication after failures is a concern, ensure idempotent writes (e.g. upsert/replace mode) instead of relying on abort cleanup

Example fix

// before
} catch (Exception e) {
    log.warn("[Instance {}] Failed to clean up during abort: {}", instanceId, e.getMessage(), e);
}
// after
} catch (Exception e) {
    if (connection != null && !connection.isClosed()) {
        connection.rollback();
    }
    log.warn("[Instance {}] Failed to clean up during abort: {}", instanceId, e.getMessage(), e);
}
Defensive patterns

Strategy: try-catch

Validate before calling

// verify connection health before job start
try (Connection c = DriverManager.getConnection(url, user, pass)) {
    if (!c.isValid(5)) throw new IllegalStateException("Databend connection invalid");
}

Type guard

if (connection == null || connection.isClosed()) {
    log.warn("Skip abort cleanup: connection already closed");
    return;
}

Try / catch

try {
    committer.abort(pendingStates);
} catch (Exception e) {
    log.warn("Abort cleanup failed; check for partial writes in Databend", e);
    // do not rethrow: abort must not mask the original job failure
}

Prevention

When it happens

Trigger: The job fails (checkpoint aborted / task cancelled) while the Databend JDBC connection is already broken, so rollback() throws SQLException; or CDC-mode cleanup throws for any reason inside the try block.

Common situations: Network blips or Databend restarts between writing and abort; connection timed out and closed by server; transaction already rolled back by another handler.

Related errors


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