{"record":{"id":"5f4532974a713248","repo":"apache/seatunnel","slug":"jdbc-connection-close-failed","errorCode":null,"errorMessage":"JDBC connection close failed.","messagePattern":"JDBC 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/connection/SimpleJdbcConnectionPoolProviderProxy.java","lineNumber":72,"sourceCode":"    @Override\n    public boolean isConnectionValid() throws SQLException {\n        return poolManager.containsConnection(queueIndex)\n                && JdbcConnectionValidationUtils.isConnectionValid(\n                        poolManager.getConnection(queueIndex), jdbcConfig);\n    }\n\n    @Override\n    public Connection getOrEstablishConnection() {\n        return poolManager.getConnection(queueIndex);\n    }\n\n    @Override\n    public void closeConnection() {\n        if (poolManager.containsConnection(queueIndex)) {\n            try {\n                poolManager.remove(queueIndex).close();\n            } catch (SQLException e) {\n                log.warn(\"JDBC connection close failed.\", e);\n            }\n        }\n    }\n\n    @Override\n    public Connection reestablishConnection() {\n        closeConnection();\n        return getOrEstablishConnection();\n    }\n}\n","sourceCodeStart":54,"sourceCodeEnd":83,"githubUrl":"https://github.com/apache/seatunnel/blob/cf67b549a7a6c35fa0beb12d83c62892427ea919/seatunnel-connectors-v2/connector-jdbc/src/main/java/org/apache/seatunnel/connectors/seatunnel/jdbc/internal/connection/SimpleJdbcConnectionPoolProviderProxy.java#L54-L83","documentation":"SimpleJdbcConnectionPoolProviderProxy.closeConnection() removes a pooled connection and calls close(); a SQLException during close is logged as a warning and swallowed. The proxy pool is best-effort cleaned up; the connection object reference is simply discarded.","triggerScenarios":"reestablishConnection() (or explicit closeConnection) finds a pooled connection for the queue index, but Connection.close() throws SQLException — typically because the connection is already dead/broken.","commonSituations":"DB restart or network failure made the pooled connection stale; driver throws on closing a connection with an unfinished transaction; pool reused across long checkpoint intervals with aggressive server-side timeouts (e.g. wait_timeout).","solutions":["Increase server-side idle timeouts (e.g. MySQL wait_timeout) or reduce checkpoint interval","Check the warning's cause for driver-specific issues (open transaction, broken socket)","Use connection test/validation query options so stale connections are detected before reuse","Ignore if it occurs during shutdown after a connection failure — cleanup is best-effort"],"exampleFix":null,"handlingStrategy":"try-catch","validationCode":null,"typeGuard":null,"tryCatchPattern":"// library swallows the exception; nothing to catch.\n// At shutdown, tolerate pooled-connection close warnings:\ntry { provider.closeConnection(); } catch (RuntimeException ignored) { }","preventionTips":["Tune server idle timeouts (wait_timeout) longer than checkpoint interval","Use validation queries to prune stale pooled connections","Expect this warning after DB restarts; it is non-fatal cleanup noise"],"tags":["jdbc","connection-pool","cleanup","warning"],"backgroundTag":"connection-refused","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"}