oracle / oci-java-sdk

Oracle Cloud Infrastructure SDK for Java
https://cloud.oracle.com/cloud-infrastructure
Other
192 stars 152 forks source link

Thread leak in IdleConnectionMonitor in Versions 3.31.0 to 3.38.0 (fixed in 3.39.0) #587

Open rkumarpa opened 3 months ago

rkumarpa commented 3 months ago

If you are using any OCI Java SDK version(s) >= 3.31.0 and <= 3.38.0 then you could see a thread leak in IdleConnectionMonitor. We recommend you to update to version 3.39.0 or later. If you are not using any of the affected OCI Java SDK versions, you can ignore this issue.

Description When using OCI Java SDK version(s) >= 3.31.0and <= 3.38.0, an increase in CPU or memory usage might occur due to the proliferation of threads of type idle-connection-monitor-thread. IdleConnectionMonitor was introduced in version 3.31.0 for each client to evict the idle and expired Apache connections and to restore connection re-use for the Apache connector. As each OCI Java SDK client spawns its own idle connection monitoring threads, these threads do not terminate unless the clients are closed (either by using "try-with-resources" or by calling the close() method). Over time, as more clients are created and not closed, the number of threads continues to grow, resulting in a build-up of unused threads and thus a thread leak.

Affected Versions

Actions Update the OCI Java SDK version to 3.39.0 or later.