RFR: 8339686: java/foreign/TestMappedHandshake.java fails with assert(depth < max_critical_stack_depth) failed: can't have more than 10 critical frames [v2]

Maurizio Cimadamore mcimadamore at openjdk.org
Mon Sep 9 15:33:45 UTC 2024


On Mon, 9 Sep 2024 15:30:47 GMT, Maurizio Cimadamore <mcimadamore at openjdk.org> wrote:

>> The new test added by https://github.com/openjdk/jdk/pull/20854 fails spuriously.
>> While JNI lookup is now moved into the static initializer of the `MappedMemoryUtils` class, this class might only get initialized while in the middle of a scoped context.
>> 
>> To address this, I created a new proxy interface, namely `MappedMemoryUtilsProxy`. This interface is used by `ScopedMemoryAccess` to call the various `force`/`load`/`isLoaded`/`unload` methods, and a singleton instance is provided inside `MappedMemoryUtils` itself, and then exposed via the `SharedSecrets` mechanism.
>> 
>> Crucially, `MappedMemorySegmentImpl` will now _first_ obtain a `MappedMemoryUtilsProxy` and _then_ call `ScopedMemoryAccess`. This should move all class initializer side-effects out of the scoped method context.
>
> Maurizio Cimadamore has updated the pull request incrementally with one additional commit since the last revision:
> 
>   Drop spurious change

src/java.base/share/classes/java/nio/MappedMemoryUtils.java line 128:

> 126:     static {
> 127:         registerNatives();
> 128:         isLoaded0(0, 0, 0);

This spurious line was added for debugging reasons in a previous PR - it should have been removed. Doing it now. This is probably the cause of https://bugs.openjdk.org/browse/JDK-8339780

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

PR Review Comment: https://git.openjdk.org/jdk/pull/20914#discussion_r1750481339


More information about the core-libs-dev mailing list