RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Nov 13 16:44:57 UTC 2023


On Mon, 13 Nov 2023 16:05:08 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

> After some offline discussions, I've decided to add a new exception (Arena.CleanupException) which is used to wrap custom cleanup action exceptions and rethrow them on close.

To be clear, the reasons as to why the original proposal was amended are as follows:

* it is a "bug" rather than a feature that exceptions are swallowed by a cleaner. Having those exceptions bubbling up when calling `Arena::close` provides meaningful diagnostic feedback;
* the fact that an automatic arena doesn't report any exception from custom cleanup can be seen explained as: a `Cleaner` will call `Arena::close` implicitly, so exceptions (including the new `Arena.CleanupException`) will be swallowed.

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

PR Comment: https://git.openjdk.org/jdk/pull/16619#issuecomment-1808531110


More information about the core-libs-dev mailing list