RFR: 8319928: Exceptions thrown by cleanup actions passed to reinterpreted segments should be ignored

Alan Bateman alanb at openjdk.org
Fri Nov 10 17:01:57 UTC 2023


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

src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java line 283:

> 281:                             cleanupAction.run();
> 282:                         } catch (Throwable ex) {
> 283:                             // swallow

@tprinzing This may be an area that you want to look at sometime to see if a JFR event might make sense.

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

PR Review Comment: https://git.openjdk.org/jdk/pull/16619#discussion_r1389654209


More information about the core-libs-dev mailing list