pgjdbc/pgjdbc GitHub issues and pull requests (mirror)
help / color / mirror / Atom feedFrom: davecramer (@davecramer) <[email protected]>
To: pgjdbc/pgjdbc <[email protected]>
Subject: Re: [pgjdbc/pgjdbc] PR #3886: fix: avoid memory leaks in Java <= 21 caused by Thread.inheritedAccessControlContext
Date: Thu, 04 Dec 2025 10:44:40 +0000
Message-ID: <[email protected]> (raw)
In-Reply-To: <[email protected]>
References: <[email protected]>
Using claude it suggested
```
ForkJoinPool.commonPool().execute(() -> {
RefQueueBlocker<Object> blocker =
new RefQueueBlocker<>(queue, threadName, threadTtl, () -> !checkEmpty());
while (!checkEmpty()) {
try {
ref.onClean(true);
ForkJoinPool.managedBlock(blocker);
Node<?> ref = (Node<?>) blocker.drainOne();
if (ref != null) {
ref.onClean(true);
}
} catch (InterruptedException e) {
if (checkEmpty()) {
LOGGER.log(Level.FINE,
"Cleanup queue is empty, and got interrupt, will terminate the cleanup thread");
break;
}
LOGGER.log(Level.FINE, "Ignoring interrupt since the cleanup queue is non-empty");
} catch (Throwable e) {
LOGGER.log(Level.WARNING, "Unexpected exception while executing onClean", e);
}
}
});
```
as a simplification to the try catch logic
Also had this to say
5. Missing edge cases
- What happens if ForkJoinPool.commonPool() is unavailable (custom security manager)?
- No handling for RejectedExecutionException from execute()
- The threadFactory.newThread() can return null but only logs a warning
-
view thread (11+ messages) latest in thread
reply
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Reply to all the recipients using the --to and --cc options:
reply via email
To: github://pgjdbc/pgjdbc
Cc: [email protected], [email protected]
Subject: Re: [pgjdbc/pgjdbc] PR #3886: fix: avoid memory leaks in Java <= 21 caused by Thread.inheritedAccessControlContext
In-Reply-To: <<[email protected]>>
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
This inbox is served by agora; see mirroring instructions
for how to clone and mirror all data and code used for this inbox