On Fri, 10 Nov 2023 16:34:11 GMT, Maurizio Cimadamore <mcimadam...@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).

Not sure whether always swallowing the exceptions is the right move... it seems 
like an advantage that explicit arenas _can_ report exceptions thrown by 
cleanup actions. Silently ignoring exceptions seems bad, but something that is 
forced when using a Cleaner. I don't think we should extend that bad behavior 
to all arenas.

I do think it is problematic that we bail out of the cleanup loop on the first 
exception, but I suggest solving this by catching the exceptions/Throwables 
thrown by individual cleanup actions, and then only propagating them at the end 
of the cleanup loop. (where, if there are multiple exceptions we can use 
`addSuppressed`).

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

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

Reply via email to