Message-ID: From: "martin-dorey-hv (@martin-dorey-hv)" To: "pgjdbc/pgjdbc" Date: Sat, 07 Mar 2026 04:23:55 +0000 Subject: [pgjdbc/pgjdbc] issue #3953: "ForkJoinPool.commonPool-worker-1" java.lang.SecurityException: setContextClassLoader List-Id: X-GitHub-Author-Id: 177168816 X-GitHub-Author-Login: martin-dorey-hv X-GitHub-Issue: 3953 X-GitHub-Repo: pgjdbc/pgjdbc X-GitHub-State: closed X-GitHub-Type: issue X-GitHub-Url: https://github.com/pgjdbc/pgjdbc/issues/3953 Content-Type: text/plain; charset=utf-8 **Describe the issue** I'm experiencing exceptions which I'm confident are a regression in the driver. **Driver Version?** 42.7.10 **Java Version?** openjdk version "1.8.0_472" OpenJDK Runtime Environment (Temurin)(build 1.8.0_472-b08) OpenJDK 64-Bit Server VM (Temurin)(build 25.472-b08, mixed mode) **OS Version?** CentOS Stream release 9 **PostgreSQL Version?** 18.3 **To Reproduce** I'm afraid that I don't know how this big hairy application that I didn't write is using PostgreSQL or the driver. I was tasked with upgrading both components. **Expected behaviour** Before the upgrades, when the driver was 42.7.8 and PostgreSQL was 18.1, the exceptions did not happen. When the driver is reverted to 42.7.8 and PostgreSQL kept at 18.3, the exceptions stop. **Logs** ``` Exception in thread "ForkJoinPool.commonPool-worker-1" java.lang.SecurityException: setContextClassLoader at java.util.concurrent.ForkJoinWorkerThread$InnocuousForkJoinWorkerThread.setContextClassLoader(ForkJoinWorkerThread.java:255) at org.postgresql.util.LazyCleanerImpl.lambda$startThread$0(LazyCleanerImpl.java:181) at java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1402) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:175) ``` The driver's source line from that stack trace is: https://github.com/pgjdbc/pgjdbc/blame/master/pgjdbc/src/main/java/org/postgresql/util/LazyCleanerImpl.java#L181 ... which was new three months ago under: https://github.com/pgjdbc/pgjdbc/commit/bdd930bf4 ... which is in the list of changes for 42.7.9: https://jdbc.postgresql.org/changelogs/2026-01-15-42/ Before that change, the call to setContextClassLoader wasn't done on a ForkJoinPool thread. I got no matches searching for issues with setContextClassLoader and figured it'd be better to have a weak report of a regression than no report. But sorry nonetheless.