RFR: 8319928: Exceptions thrown by cleanup actions should be handled correctly [v3]
Maurizio Cimadamore
mcimadamore at openjdk.org
Thu Nov 16 18:27:35 UTC 2023
On Thu, 16 Nov 2023 18:24:44 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:
>> This simplePR tweaks the factory which wraps custom cleanup actions passed to `MemorySegment::reinterpret`, so that any exception thrown by the custom cleanup is swallowed when the arena is closed.
>>
>> This aligns the behavior of confined/shared session with that of implicit session (as implicit sessions are backed by a `Cleaner`, there is no way for cleanup exception to bubble up).
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
>
> Address CSR comments
During the CSR review and an offline discussion with @jddarcy, it was pointed out that there's not a lot of value to be specific about this kind of exception, given that clients might not be able to do much with it (after all, if a cleanup action fails, the arena is compromised, and recovery is impossible).
For this reason, we opted for a much simpler fix, where we just document that `Arena::close` might throw some runtime exception coming from the cleanup action.
To be nice, in the implementation, we try to handle runtime exceptions (not errors!), and use `addSuppressed` accordingly, to do as much cleanup as we can. This part is optional and unspecified.
-------------
PR Comment: https://git.openjdk.org/jdk/pull/16619#issuecomment-1815003845
More information about the core-libs-dev
mailing list