RFR: 8362123: ClassLoader Leak via Executors.newSingleThreadExecutor(...) [v2]

Viktor Klang vklang at openjdk.org
Thu Oct 2 10:34:52 UTC 2025


On Fri, 26 Sep 2025 16:42:49 GMT, Chris Dennis <duke at openjdk.org> wrote:

>> Executors shutdown via `shutdownNow()` should have their cleanables cleaned to prevent a classloader leak. This can happen if a classloader exists that both references the wrapped executor and is referenced by the delegate executor.
>> 
>> To quote @Martin-Buchholz:
>>> BTW: I find Cleaners much harder to use than old finalize, and it looks like I'm not the only one!
>
> Chris Dennis has updated the pull request with a new target base due to a merge or a rebase. The incremental webrev excludes the unrelated changes brought in by the merge/rebase. The pull request contains one additional commit since the last revision:
> 
>   8362123: ClassLoader Leak via Executors.newSingleThreadExecutor(...)
>   
>   Executors shutdown via `shutdownNow()` should have their cleanables cleaned to
>   prevent a classloader leak. This can happen if a classloader exists that both
>   references the wrapped executor and is referenced by the delegate executor.

Looks good, thanks for addressing this!

-------------

Marked as reviewed by vklang (Reviewer).

PR Review: https://git.openjdk.org/jdk/pull/26296#pullrequestreview-3293857262


More information about the core-libs-dev mailing list