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

Duncan McLean duncan.mclean at gmail.com
Mon May 17 16:12:36 UTC 2021

Thank you so much Jorn and Maurizio, I really appreciate the time and
effort looking into this. I have made the change you pointed out Jorn and
it also now works for me.

I'll be sure to get the next early access build as soon as it's available
to keep my code up-to-date.

Thanks again,

On Mon, May 17, 2021 at 8:50 AM Maurizio Cimadamore <
maurizio.cimadamore at oracle.com> wrote:

> 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.
> Maurizio
> 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