{"record":{"id":"af4601fd98968d8d","repo":"apache/seatunnel","slug":"instance-failed-to-clean-up-during-abort","errorCode":null,"errorMessage":"[Instance {}] Failed to clean up during abort: {}","messagePattern":"\\[Instance (.+?)\\] Failed to clean up during abort: (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/sink/DatabendSinkAggregatedCommitter.java","lineNumber":237,"sourceCode":"        return new DatabendSinkAggregatedCommitInfo(commitInfos, null, null);\n    }\n\n    @Override\n    public void abort(List<DatabendSinkAggregatedCommitInfo> aggregatedCommitInfos)\n            throws IOException {\n        aborted = true;\n        // In case of abort, we might want to clean up the raw table and stream\n        log.info(\"[Instance {}] Aborting Databend sink operations\", instanceId);\n        try {\n            if (isCdcMode && connection != null && !connection.isClosed()) {\n                // In the new approach, raw table and stream names are not stored in this class\n                // Cleanup would need to be handled differently or at the DatabendSink level\n                log.info(\n                        \"[Instance {}] CDC mode abort - cleanup handled at DatabendSink level\",\n                        instanceId);\n            }\n        } catch (Exception e) {\n            log.warn(\n                    \"[Instance {}] Failed to clean up during abort: {}\",\n                    instanceId,\n                    e.getMessage(),\n                    e);\n        }\n    }\n\n    @Override\n    public void close() throws IOException {\n        Exception closeException = null;\n        try {\n            if (!aborted && isCdcMode && connection != null && !connection.isClosed()) {\n                try {\n                    log.info(\"[Instance {}] Performing final merge before closing\", instanceId);\n                    performMerge();\n                } catch (Exception mergeEx) {\n                    log.error(\n                            \"[Instance {}] Final merge failed, will still close connection: {}\",","sourceCodeStart":219,"sourceCodeEnd":255,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-databend/src/main/java/org/apache/seatunnel/connectors/seatunnel/databend/sink/DatabendSinkAggregatedCommitter.java#L219-L255","documentation":"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.","triggerScenarios":"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.","commonSituations":"Network blips or Databend restarts between writing and abort; connection timed out and closed by server; transaction already rolled back by another handler.","solutions":["Check Databend connectivity and connection timeout settings to keep the connection alive until abort","Verify credentials and that the Databend user has rights to roll back the active transaction","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","If data duplication after failures is a concern, ensure idempotent writes (e.g. upsert/replace mode) instead of relying on abort cleanup"],"exampleFix":"// before\n} catch (Exception e) {\n    log.warn(\"[Instance {}] Failed to clean up during abort: {}\", instanceId, e.getMessage(), e);\n}\n// after\n} catch (Exception e) {\n    if (connection != null && !connection.isClosed()) {\n        connection.rollback();\n    }\n    log.warn(\"[Instance {}] Failed to clean up during abort: {}\", instanceId, e.getMessage(), e);\n}","handlingStrategy":"try-catch","validationCode":"// verify connection health before job start\ntry (Connection c = DriverManager.getConnection(url, user, pass)) {\n    if (!c.isValid(5)) throw new IllegalStateException(\"Databend connection invalid\");\n}","typeGuard":"if (connection == null || connection.isClosed()) {\n    log.warn(\"Skip abort cleanup: connection already closed\");\n    return;\n}","tryCatchPattern":"try {\n    committer.abort(pendingStates);\n} catch (Exception e) {\n    log.warn(\"Abort cleanup failed; check for partial writes in Databend\", e);\n    // do not rethrow: abort must not mask the original job failure\n}","preventionTips":["Keep Databend connections healthy (timeouts, keepalive) so rollback during abort works","Use idempotent/upsert writes so failed-abort duplicates are harmless","Monitor WARN logs for abort failures correlated with job failures"],"tags":["jdbc","transaction","cleanup","databend"],"backgroundTag":"database-write-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T05:17:10.506Z"}