bloomberg / bloomberg/comdb2

OOM error on Comdb2 JDBC driver

Open
#3,755 2 comments 0 reactions 0 assignees View on GitHub
Dominant language
C
Stars
1.5k
Forks
243
Avg merge
2d 2h
Merged PRs (30d)
37

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 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:
```bash
$ uname -a
Linux 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)
```

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.