[External] : Re: Help with VM Crash using the foreign linker

Maurizio Cimadamore maurizio.cimadamore at oracle.com
Mon May 17 12:49:39 UTC 2021

Good catch Jorn.

I confirm that this fixes the problem on Linux too (Duncan, I've been 
able to make your project work on my Ubuntu :-) ).

As for unexpected unloading, two notes as to how we're improving the 
situation in the recent panama/17

* memory addresses are now scoped entities - which means having an 
address on your hand will keep the scope reachable. So, in 17 this 
failure wouldn't be possible.

* The recent changes to drop the parallel library loading mechanism 
would make this even harder to reproduce, as in the latest panama repo, 
libraries are loaded by class loaders, and you can only ask the library 
lookup for the current class loader.


On 17/05/2021 13:23, Jorn Vernee wrote:
> However, in PassportFactory, you are discarding the Symbol, and only 
> keeping the address:
> MethodHandle methodHandle =linker.
>          downcallHandle(symb.address(),  <---------------
>                  MethodType.methodType(methRet,parameters),
>                  fd);
> Which means the library will not be kept loaded by the MethodHandle, 
> and indeed it is being unloaded.
> Symbol implements Addressable already, so there is no need to call 
> .address() here. If I remove that call, the crash goes away, and the 
> test passes.

More information about the panama-dev mailing list