apache/seatunnel · warning
Connection close failed.
Error message
Connection close failed.
What it means
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.
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
Defensive patterns
Strategy: try-catch
Validate before calling
// Health-check the DB before job start/shutdown
try (Connection c = DriverManager.getConnection(url, user, pass)) {
c.isValid(5);
} Try / catch
try {
xaFacade.closeConnection();
} catch (Exception e) {
LOG.warn("Connection close failed (swallowed by facade)", e);
} Prevention
- 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
When it happens
Trigger: closeConnection() invokes close() and the underlying connection.close() throws SQLException (broken network, DB session already terminated, driver error).
Common situations: Sink close during job cancellation with a dead DB; DB failover/kill of the session before shutdown; idle-connection timeout.
Understand the failure class
Background: ECONNREFUSED and "connection refused" / "could not connect to server" errors: what they mean and how to fix them — this error's family across 44 libraries.
Related errors
- unable to close XA connection
- begin next transaction failed, rollback prepared…
- CLASS_NOT_FOUND
- COMMON_ILLEGAL_ARGUMENT
- COMMON_UNSUPPORTED_OPERATION
AI-assisted analysis of apache/seatunnel@cf67b549a7 (2026-09-10).
Data as JSON: /api/errors/1940479b686e188b.
Report an issue: GitHub.
Appendix: source
Thrown at seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/xa/XaFacadeImplAutoLoad.java:167
@Override
public boolean isConnectionValid() throws SQLException {
return isOpen() && connection.isValid(connection.getNetworkTimeout());
}
@Override
public Connection getOrEstablishConnection() throws SQLException {
if (!isOpen()) {
open();
}
return connection;
}
@Override
public void closeConnection() {
try {
close();
} catch (SQLException e) {
LOG.warn("Connection close failed.", e);
}
}
@Override
public Connection reestablishConnection() {
throw new JdbcConnectorException(
CommonErrorCodeDeprecated.UNSUPPORTED_OPERATION,
"The instance failed to implement this method");
}
@Override
public void start(Xid xid) {
execute(Command.fromRunnable("start", xid, () -> xaResource.start(xid, TMNOFLAGS)));
}
@Override
public void endAndPrepare(Xid xid) {
execute(Command.fromRunnable("end", xid, () -> xaResource.end(xid, XAResource.TMSUCCESS)));View on GitHub (pinned to cf67b549a7)