Spring Webflux R2DBC Connection Pool - Heap Memory Issue

83 views
Skip to first unread message

bubeshkumar d

unread,
Aug 21, 2024, 7:15:52 AM8/21/24
to r2dbc
Using r2dbc-oracle with connection pool in my spring webflux application. Functionally all select, update working fine from r2dbc repository. we started observing buildup of classes related to oracle connection in heap memory and heap is continuously growing. When checked heap dump with eclipse memory analyzer, below is the leak suspect report. Seems oracle connection related objects not getting garbage collected, can anyone help with rectifying this issue?

oracle-r2dbc: 0.4.0
r2dbc-spi: 0.9.1
r2dbc-pool: 0.9.2

R2dbc connection pool

ConnectionPoolConfiguration configuration = ConnectionPoolConfiguration.builder(factory)
.maxIdleTime(Duration.ofMillis(15000))
.initialSize(Integer.parseInt(10))
.maxSize(Integer.parseInt(200))
.build();


Leak suspect report

The class oracle.jdbc.replay.driver.ReplayStatisticsMBeanImpl, loaded by org.springframework.boot.loader.LaunchedURLClassLoader @ 0x700cd2778, occupies 2.10 GB (94.21%) bytes. The memory is accumulated in one instance of java.util.HashMap$Node[], loaded by <system class loader>, which occupies 2.10 GB (94.21%) bytes.

Keywords

  • oracle.jdbc.replay.driver.ReplayStatisticsMBeanImpl
  • org.springframework.boot.loader.LaunchedURLClassLoader @ 0x700cd2778
  • java.util.HashMap$Node[] 

Michael McMahon

unread,
Aug 21, 2024, 9:06:50 PM8/21/24
to r2dbc
Thank you for reporting this! I work on both Oracle R2DBC and Oracle JDBC,  and I can investigate further if needed.

For now, you might want to try overriding the Oracle JDBC dependency. In your pom.xml, or equivalent for gradle:
<dependency>
   <groupId>com.oracle.database.jdbc</groupId>
  <artifactId>ojdbc11</artifactId>
  <version>23.5.0.24.07</version>
</dependency>

The bug sounds vaguely familiar, so I think we may have fixed it long ago. But your 0.4.0 release of Oracle R2DBC is pulling in an old version of ojdbc11. The new version may very well have a fix.

FWIW, I've been working on an update for Oracle R2DBC where I've verified the latest build with the 23.5.0.24.07 ojdbc11 version listed above. I believe it will be compatible with the 0.4.0 release of ojdbc11.

bubeshkumar d

unread,
Aug 23, 2024, 1:30:42 AM8/23/24
to r2dbc
Thanks for your response. Will try to use ojdbc version you suggested and see whether it is resolving the issue.  
Reply all
Reply to author
Forward
0 new messages