Description
Describe the bug
Each Comdb2Connection
has an internal Comdb2Handle
that is reused across all statements for the given connection. Because of this, there's a potential for the internal List<String> set
commands that is used to keep track of the set
commands to grow unbounded and cause OOM errors. This is not a theoretical problem: we've encountered this issue when running the latest 2.6.0
version of the JDBC driver.
To Reproduce
Steps to reproduce the behavior:
Please refer to the https://github.com/hgeraldino/comdb2-oom-example repository, which has a sample Integration Test that can be used to reproduce the problem.
Expected behavior
Each java.sql.Statement
should only care about the set
SQL statements of its own.
Screenshots
The referenced project has a Screenshot of a heap dump taken from one of our running applications. It shows the enormous number of String references kept by the Comdb2Handle
.
Environment (please complete the following information):
- Operating System and Version:
$ uname -a
Linux <hostname> 3.10.0-1160.80.1.el7.x86_64 #1 SMP Sat Oct 8 18:13:21 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
$ java -version
openjdk version "17.0.6" 2023-01-17
OpenJDK Runtime Environment Temurin-17.0.6+10 (build 17.0.6+10)
OpenJDK 64-Bit Server VM Temurin-17.0.6+10 (build 17.0.6+10, mixed mode, sharing)