[branch-2.1][fix](jdbc catalog) Fixed FE memory leak by enabling weak references in HikariCP (#40923)

pick  (#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.
This commit is contained in:
zy-kkk
2024-09-19 23:59:14 +08:00
committed by GitHub
parent 549bc3e288
commit 8b1906be81

View File

@ -97,6 +97,7 @@ public abstract class JdbcClient {
}
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());