On Fri, 27 May 2022 10:29:14 GMT, Maurizio Cimadamore <mcimadam...@openjdk.org> wrote:
> This patch fix a missing rethrow in `MemorySessionImpl::addOrCleanupIfFail`. > As noted in the JBS issue, this bug does not affect correctness, but it > delays error reporting. > > Writing a test for this is nearly impossible, given that (a) a memory > resource created against a closed session would be inaccessible by clients > (because the session is closed!), and (b) because of the narrow window in > which the problem might manifest (for this problem to occur, a session state > change would have to occur between the first state check and when the cleanup > action list is updated). src/java.base/share/classes/jdk/internal/foreign/MemorySessionImpl.java line 112: > 110: // to the list (and, in case of an add vs. close race, it might > happen that the cleanup action will be > 111: // called immediately after). > 112: resourceList.add(resource); Note that I've removed the try/catch, as resourceList::add cannot throw the ScopedAccessError singleton (that is only issued in the raw/internal `checkValidState`) ------------- PR: https://git.openjdk.java.net/jdk/pull/8917