[foreign-memaccess+abi] RFR: 8317514: Ensure MemorySegment is initialized before touching NativeMemorySegmentImpl [v2]
Maurizio Cimadamore
mcimadamore at openjdk.org
Mon Oct 9 21:06:28 UTC 2023
On Mon, 9 Oct 2023 19:10:09 GMT, Jorn Vernee <jvernee at openjdk.org> wrote:
>> I'll try to add a test for mapped segments as well (through FileChannel::map). Though, it might not be possible to reproduce an issue in a test.
>>
>> But, the other two do not touch NativeMemorySegmentImpl or MappedMemorySegmentImpl directly, so I'm not sure. Theoretically we can test all the API points (that create MemorySegments), but given the tricky timing (the current test has to carefully pre-initialize several classes to get there), I'm not sure it's useful to spend resources on running those tests.
>
> I've added a similar test for FileChannel::map, but was not able to reproduce a deadlock. The log shows that the basic conditions are right, but I guess we just miss the timing:
>
>
> [0.182s][info][class,init] 728 Initializing 'java/lang/foreign/MemorySegment' (0x0000021a82050320) by thread "Thread-2"
> [0.183s][info][class,init] 729 Initializing 'jdk/internal/foreign/AbstractMemorySegmentImpl' (0x0000021a82050d28) by thread "Thread-2"
> [0.183s][info][class,init] 730 Initializing 'jdk/internal/foreign/NativeMemorySegmentImpl' (0x0000021a82051598) by thread "Thread-2"
> [0.183s][info][class,init] 731 Initializing 'jdk/internal/foreign/MappedMemorySegmentImpl' (0x0000021a82051e20) by thread "Thread-1"
That's ok - at least we have that covered, and, hopefully it will start to fail from time to time if we regress
-------------
PR Review Comment: https://git.openjdk.org/panama-foreign/pull/902#discussion_r1350786092
More information about the panama-dev
mailing list