Subject: [pgjdbc/pgjdbc] issue #4037: StatementTest fails with JDK 8

From: "harudini (@harudini)" <[email-masked]>
Date: Wed, 22 Apr 2026 08:20:47 +0000

**Describe the issue**
Running the test suite with JDK 8 fails, while it succeeds on JDK 11 and later.
The failure appears during execution of StatementTest, eventually resulting in an OutOfMemoryError.

This issue started after the following commit (https://github.com/pgjdbc/pgjdbc/commit/bdd930bf458e3d490d93edc4dc24a67e3a2d5964).

**Driver Version?** 

**Java Version?**
OpenJDK 8

**OS Version?**
RHEL8

**PostgreSQL Version?**
18.3

**To Reproduce**
`./gradlew -PjdkBuildVersion=17 -PjdkTestVersion=8 test`

**Expected behaviour**
All test to pass.

**Logs**
```
StatementTest > fastCloses() STANDARD_OUT
    [testFastCloses] total counts for each sql state: {0=102, 55000=898}
          2.4sec, org.postgresql.test.jdbc2.StatementTest > cancelQueryWithBrokenNetwork()
FAILURE   0.0sec, UnknownClass > executionError
    org.junit.platform.commons.JUnitException: TestEngine with ID 'junit-jupiter' failed to execute tests
        Caused by: org.junit.platform.commons.JUnitException: Error executing tests for engine junit-jupiter
            Caused by: java.util.concurrent.ExecutionException: java.lang.OutOfMemoryError
                at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1006)
                Caused by: java.lang.OutOfMemoryError
                    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
                    at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
                    Caused by: java.lang.OutOfMemoryError: GC overhead limit exceeded
                        at org.postgresql.test.jdbc2.StatementTest.sideStatementFinalizers(StatementTest.java:1076
```

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Wed, 22 Apr 2026 09:22:58 +0000

Does it reproduce every time?
Could you capture a heap dump and analyze the reason for OOM?

PS. We execute tests with Java 8 in CI and it does not fail with OOM: https://github.com/pgjdbc/pgjdbc/actions/runs/24677228987/job/72164505739

---

From: "vlsi (@vlsi)" <[email-masked]>
Date: Wed, 22 Apr 2026 10:32:16 +0000

Interestingly, I was able to reproduce the failure with `-XX:ActiveProcessorCount=2` locally, and https://github.com/pgjdbc/pgjdbc/pull/4038 helps.