{"record":{"id":"ef0d645508885045","repo":"apache/seatunnel","slug":"unable-to-fail-rollback-transaction-xid","errorCode":null,"errorMessage":"unable to fail/rollback transaction, xid={}: {}","messagePattern":"unable to fail/rollback transaction, xid=(.+?): (.+?)","errorType":"console","errorClass":null,"httpStatus":null,"severity":"warning","filePath":"seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaGroupOpsImpl.java","lineNumber":109,"sourceCode":"\n    @Override\n    public GroupXaOperationResult<XidInfo> failAndRollback(Collection<XidInfo> xids) {\n        GroupXaOperationResult<XidInfo> result = new GroupXaOperationResult<>();\n        if (xids.isEmpty()) {\n            return result;\n        }\n        if (LOG.isDebugEnabled()) {\n            LOG.debug(\"rolling back {} transactions: {}\", xids.size(), xids);\n        }\n        for (XidInfo x : xids) {\n            try {\n                xaFacade.failAndRollback(x.getXid());\n                result.succeeded(x);\n            } catch (XaFacade.TransientXaException e) {\n                LOG.info(\"unable to fail/rollback transaction, xid={}: {}\", x, e.getMessage());\n                result.failedTransiently(x, e);\n            } catch (Exception e) {\n                LOG.warn(\"unable to fail/rollback transaction, xid={}: {}\", x, e.getMessage());\n                result.failed(x, e);\n            }\n        }\n        if (!result.getForRetry().isEmpty()) {\n            LOG.info(\"failed to roll back {} transactions\", result.getForRetry().size());\n        }\n        return result;\n    }\n\n    @Override\n    public void recoverAndRollback(\n            JobContext context,\n            SinkWriter.Context sinkContext,\n            XidGenerator xidGenerator,\n            Xid excludeXid) {\n        Collection<Xid> recovered =\n                xaFacade.recover().stream()\n                        .map(","sourceCodeStart":91,"sourceCodeEnd":127,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaGroupOpsImpl.java#L91-L127","documentation":"A WARN log in XaGroupOpsImpl.failAndRollback() when rolling back a prepared transaction fails with a non-transient exception. Each xid is ended and rolled back (abort path); transient failures are logged at INFO and kept for retry, but generic Exceptions are logged at WARN and the transaction is marked failed. This typically happens during sink abort or checkpoint decline cleanup.","triggerScenarios":"For each buffered transaction, xaFacade.failAndRollback(x.getXid()) throws a non-XaFacade.TransientXaException Exception (e.g. connection dead, XA protocol error); the code logs 'unable to fail/rollback transaction, xid={}' and records result.failed(x, e).","commonSituations":"Aborting a checkpoint while the DB connection is broken; XAER_NOTA because the transaction was already resolved; driver errors during end(fail)/rollback.","solutions":["Inspect the exception cause per xid in the logs; XAER_NOTA means it was already rolled back/committed — safe to ignore","Restore DB connectivity and let recovery roll back remaining prepared transactions (they will be found via xa_recover)","Check for another process concurrently recovering the same xids","If rollback failures are persistent, manually resolve in-doubt transactions in the DB"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Before abort cleanup, confirm DB reachability to reduce non-transient failures\ntry (Connection c = dataSource.getConnection()) { c.isValid(3); }","typeGuard":null,"tryCatchPattern":"try {\n    xaFacade.failAndRollback(xid);\n} catch (XaFacade.TransientXaException e) {\n    LOG.info(\"transient, kept for retry: {}\", xid);\n} catch (Exception e) {\n    LOG.warn(\"unable to fail/rollback transaction, xid={}: {}\", xid, e.getMessage());\n}","preventionTips":["Distinguish XAER_NOTA (already resolved, benign) from real errors in logs","Resolve in-doubt transactions manually if persistent","Avoid aborting checkpoints while the DB is unreachable"],"tags":["jdbc","xa","rollback","abort"],"backgroundTag":"sql-query-failed","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-14T11:17:12.474Z"}