OpenSSL and panama-foreign
Maurizio Cimadamore
maurizio.cimadamore at oracle.com
Thu Nov 11 01:52:40 UTC 2021
I think I managed to figure out what introduced the regression.
Basically, it's down to the removal of customization for upcall stubs.
```
@@ -123,7 +120,7 @@ public static UpcallHandler make(ABIDescriptor abi, MethodHandle target, Calling
.anyMatch(s -> abi.arch.isStackType(s.type()));
if (USE_INTRINSICS && isSimple && !usesStackArgs && supportsOptimizedUpcalls()) {
checkPrimitive(doBindings.type());
- JLI.ensureCustomized(doBindings);
+ doBindings = insertArguments(exactInvoker(doBindings.type()), 0, doBindings);
VMStorage[] args = Arrays.stream(argMoves).map(Binding.Move::storage).toArray(VMStorage[]::new);
VMStorage[] rets = Arrays.stream(retMoves).map(Binding.Move::storage).toArray(VMStorage[]::new);
CallRegs conv = new CallRegs(args, rets);
```
If this patch is reverted, then everything works as expected (I've run
your `ab` test 10 consecutive times, no crashes). Which seems like a
latent bug in the upcall machinery.
That said, I think that, for the time being, it would be best to revert
this code to what it was in 17, to avoid these spurious crashes.
I wonder if the reason behind the issue we're seeing is caused by the
Addressable vs. MemoryAddress mismatch in the method type - e.g. maybe
`exactInvoker(doBindings.type())` doesn't do what we think it should.
I'll keep investigating tomorrow (well, later today :-) ).
Cheers
Maurizio
On 10/11/2021 22:38, Maurizio Cimadamore wrote:
> And, on this same vein, even with the resource scope handshake
> disabled, Tomcat still crashes with the following Java option:
>
> export JAVA_OPTS="-XX:+DeoptimizeALot
> --enable-native-access=ALL-UNNAMED --add-modules jdk.incubator.foreign"
>
> DeoptimizeALot causes frequent deopt events in the VM. The handshake
> we use for shared segments also used deopt events. Something got
> broken here and the upcall intrinsic doesn't seem to be able to handle
> deopt events.
>
> Maurizio
>
>
> On 10/11/2021 22:27, Maurizio Cimadamore wrote:
>> This seems to point at some issues with the shared scope logic
>> interacting badly with upcall intrinsics. But neither areas have
>> changed significantly since 17, which makes this very odd.
More information about the panama-dev
mailing list