{"record":{"id":"1940479b686e188b","repo":"apache/seatunnel","slug":"connection-close-failed","errorCode":null,"errorMessage":"Connection close failed.","messagePattern":"Connection close failed\\.","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/XaFacadeImplAutoLoad.java","lineNumber":167,"sourceCode":"    @Override\n    public boolean isConnectionValid() throws SQLException {\n        return isOpen() && connection.isValid(connection.getNetworkTimeout());\n    }\n\n    @Override\n    public Connection getOrEstablishConnection() throws SQLException {\n        if (!isOpen()) {\n            open();\n        }\n        return connection;\n    }\n\n    @Override\n    public void closeConnection() {\n        try {\n            close();\n        } catch (SQLException e) {\n            LOG.warn(\"Connection close failed.\", e);\n        }\n    }\n\n    @Override\n    public Connection reestablishConnection() {\n        throw new JdbcConnectorException(\n                CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,\n                \"The instance failed to implement this method\");\n    }\n\n    @Override\n    public void start(Xid xid) {\n        execute(Command.fromRunnable(\"start\", xid, () -> xaResource.start(xid, TMNOFLAGS)));\n    }\n\n    @Override\n    public void endAndPrepare(Xid xid) {\n        execute(Command.fromRunnable(\"end\", xid, () -> xaResource.end(xid, XAResource.TMSUCCESS)));","sourceCodeStart":149,"sourceCodeEnd":185,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaFacadeImplAutoLoad.java#L149-L185","documentation":"A WARN log in XaFacadeImplAutoLoad.closeConnection() — the wrapper that closes the facade swallows any SQLException raised by close() and only logs 'Connection close failed.' It exists so sink cleanup (e.g. on checkpoint abort or task shutdown) never throws. The error indicates the XA connection could not be cleanly released; the job continues or terminates without failing on this.","triggerScenarios":"closeConnection() invokes close() and the underlying connection.close() throws SQLException (broken network, DB session already terminated, driver error).","commonSituations":"Sink close during job cancellation with a dead DB; DB failover/kill of the session before shutdown; idle-connection timeout.","solutions":["Check DB connectivity and firewall/idle timeouts to avoid stale sessions at close time","Inspect the logged SQLException cause for the real problem (auth, network, driver)","Ignore if it occurs only at job shutdown after a network break — resources are reclaimed eventually","Ensure the JDBC driver version matches the DB server version"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":"// Health-check the DB before job start/shutdown\ntry (Connection c = DriverManager.getConnection(url, user, pass)) {\n    c.isValid(5);\n}","typeGuard":null,"tryCatchPattern":"try {\n    xaFacade.closeConnection();\n} catch (Exception e) {\n    LOG.warn(\"Connection close failed (swallowed by facade)\", e);\n}","preventionTips":["Treat this WARN as diagnostic only — the facade never rethrows it","Inspect the nested SQLException for the root cause (network, auth, driver)","Keep JDBC driver and DB server versions aligned"],"tags":["jdbc","xa","connection-close"],"backgroundTag":"connection-refused","analyzedSha":"cf67b549a7a6c35fa0beb12d83c62892427ea919","analyzedAt":"2026-09-10T21:44:55.265Z","contentChangedAt":"2026-09-10T21:44:55.265Z","schemaVersion":2},"datasetVersion":"2026-09-23T08:17:48.524Z"}