On Fri, 19 May 2023 06:58:49 GMT, Matthias Baesken <mbaes...@openjdk.org> wrote:
> MappedMemoryUtils.c can generate exceptions like those : > java.io.UncheckedIOException: java.io.IOException: Invalid argument > at > java.base/java.nio.MappedMemoryUtils.force(MappedMemoryUtils.java:105) > at java.base/java.nio.Buffer$2.force(Buffer.java:890) > at > java.base/jdk.internal.misc.ScopedMemoryAccess.forceInternal(ScopedMemoryAccess.java:317) > at > java.base/jdk.internal.misc.ScopedMemoryAccess.force(ScopedMemoryAccess.java:305) > at > java.base/jdk.internal.foreign.MappedMemorySegmentImpl.force(MappedMemorySegmentImpl.java:92) > at > TestByteBuffer.testMappedSegmentAsByteBuffer(TestByteBuffer.java:327) > > (we see this for example on AIX); there is some room for improvement, at > least the info should be added that msync failed and caused this exception. src/java.base/share/native/libjava/jni_util.c line 196: > 194: { > 195: JNU_ThrowByNameWithMessageAndLastError(env, "java/io/IOException", > message); > 196: } The additional function looks okay but I think the function description would be clearer if it were like this /* * Throw java.io.IOException using a given message and the string * returned by getLastErrorString to construct the detail string. */ I see JNU_ThrowIOExceptionWithLastError also "Convenience method" but it's a function :-) src/java.base/unix/native/libnio/MappedMemoryUtils.c line 114: > 112: if (result == -1) { > 113: JNU_ThrowIOExceptionWithMessageAndLastError(env, "madvise with > parameter MADV_WILLNEED failed"); > 114: } Maybe change "with parameter" to "with advise" so it's clearer what the value is about? ------------- PR Review Comment: https://git.openjdk.org/jdk/pull/14054#discussion_r1198727146 PR Review Comment: https://git.openjdk.org/jdk/pull/14054#discussion_r1198728333