0

In my Spring boot application,

datasource:
    oracle:
      hikari:
        jdbc-url: URL
        username: Username
        password: password
        minimum-idle: 3
        maximum-pool-size: 10
        max-lifetime: 0
        connection-test-query: select 1 from dual
        leak-detection-threshold: 10000
        driver-class-name: oracle.jdbc.OracleDriver
        idleTimeout: 0
        keepaliveTime: 300000

With this config, I'm getting error:

com.zaxxer.hikari.pool.ProxyLeakTask : Connection leak detection triggered for oracle.jdbc.driver.T4CConnection@48063c71 on thread taskExecutor-1, stack trace follows
java.lang.Exception: Apparent connection leak detected
Previously reported leaked connection oracle.jdbc.driver.T4CConnection@48063c71 on thread taskExecutor-1 was returned to the pool (unleaked)

The memory usage in AppMetrix has jumped to 90% which is extremely high. Now, if I run any other job, the issue will be Heap out of memory.

Any suggestions on how this can be fixed?

just_curious
  • 21
  • 1
  • 8

1 Answers1

0

I think it is due to a low value of hikari.leakDetectionThreshold property (10000 ms i.e 10 seconds). Try increasing it to 1 minute (60000 ms).

charybr
  • 1,888
  • 24
  • 29
  • Should I change any other parameter or just leakDetectionThreshold? – just_curious Feb 18 '22 at 18:02
  • changing leakDetectionThreshold parameter should be sufficient. – charybr Feb 18 '22 at 18:06
  • Does this also affect memory % usage or this fix just caters to "Apparent connection leak detected" warning? – just_curious Feb 18 '22 at 20:15
  • No it doesnt. Refer https://github.com/brettwooldridge/HikariCP. leakDetectionThreshold This property controls the amount of time that a connection can be out of the pool before a message is logged indicating a possible connection leak. A value of 0 means leak detection is disabled. Lowest acceptable value for enabling leak detection is 2000 (2 seconds). Default: 0 – charybr Feb 19 '22 at 08:29