Skip to content

Commit

Permalink
[branch-2.1][fix](jdbc catalog) Fixed FE memory leak by enabling weak…
Browse files Browse the repository at this point in the history
… references in HikariCP (apache#40923)

pick  (apache#40773)

When FE collects statistics, its ThreadLocal will hold the ThreadLocal
of HikariCP in JdbcClient, making it difficult for HikariCP to be gc, so
this problem can be alleviated by enabling weak references of HikariCP.
  • Loading branch information
zy-kkk committed Oct 8, 2024
1 parent 2d18178 commit b16c091
Showing 1 changed file with 1 addition and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,6 +99,7 @@ public static JdbcClient createJdbcClient(JdbcClientConfig jdbcClientConfig) {
}

protected JdbcClient(JdbcClientConfig jdbcClientConfig) {
System.setProperty("com.zaxxer.hikari.useWeakReferences", "true");
this.catalogName = jdbcClientConfig.getCatalog();
this.jdbcUser = jdbcClientConfig.getUser();
this.isOnlySpecifiedDatabase = Boolean.parseBoolean(jdbcClientConfig.getOnlySpecifiedDatabase());
Expand Down

0 comments on commit b16c091

Please sign in to comment.