From bf08de3ad61846a70624359ed4e1a5859fc66aeb Mon Sep 17 00:00:00 2001 From: Qi Chen Date: Sat, 21 Sep 2024 20:38:26 +0800 Subject: [PATCH] [Fix](jdbc-scanner) Fix jdbc scanner memory leak because it didn't close `outputTable`. (#41041) ## Proposed changes [Fix] (jdbc-scanner) Fix jdbc scanner memory leak because it didn't close `outputTable`. --- .../main/java/org/apache/doris/jdbc/BaseJdbcExecutor.java | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/BaseJdbcExecutor.java b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/BaseJdbcExecutor.java index 67a0cf5a636b34..5f132871a0c8ae 100644 --- a/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/BaseJdbcExecutor.java +++ b/fe/be-java-extensions/jdbc-scanner/src/main/java/org/apache/doris/jdbc/BaseJdbcExecutor.java @@ -99,6 +99,9 @@ public BaseJdbcExecutor(byte[] thriftParams) throws Exception { } public void close() throws Exception { + if (outputTable != null) { + outputTable.close(); + } try { if (stmt != null && !stmt.isClosed()) { try { @@ -111,8 +114,8 @@ public void close() throws Exception { if (conn != null && resultSet != null) { abortReadConnection(conn, resultSet); } - closeResources(resultSet, stmt, conn); } finally { + closeResources(resultSet, stmt, conn); if (config.getConnectionPoolMinSize() == 0 && hikariDataSource != null) { hikariDataSource.close(); JdbcDataSource.getDataSource().getSourcesMap().remove(config.createCacheKey());