Crash from upcall usage

Mark Hammons markehammons at gmail.com
Mon Jan 31 08:55:48 UTC 2022


Hi, sorry, I wasn't aware these would be stripped. Here's google drive
links to the compilation log and crash report.
 hs_err_pid596033.log.gz
<https://drive.google.com/file/d/1xAGG4YehqNRX5r-VNsq7PwifIIoIzbFT/view?usp=drive_web>

 hotspot_pid596033.log.gz
<https://drive.google.com/file/d/1EcZ9fmlWZlcsxSPrCk2f6wUQWO7ng-Jw/view?usp=drive_web>


On Mon, Jan 31, 2022 at 12:03 AM David Holmes <david.holmes at oracle.com>
wrote:

> Hi Mark,
>
> FYI attachments gets stripped from the mailing list so a link to your
> logs will be needed.
>
> Thanks,
> David
>
> On 30/01/2022 5:39 am, Mark Hammons wrote:
> > Hi Panama team,
> >
> > I was testing my library earlier today, and I noticed that when I call
> > qsort with integer arrays of size 10000 or greater, I have an increasing
> > chance (not 100% at 10000) of a jvm crash. I downloaded and used OpenJDK
> > 64-Bit Server VM (build 17-panama+3-167, mixed mode, sharing)
> > and reran my tests and I think that the crash is being triggered by C2
> > compilation of a lambda I'm passing to qsort, but I'm not certain.
> >
> > I've attached the error report and compilation logs of my program.
> >
> >
> >
> https://gitlab.com/mhammons/slinc/-/blob/44-crash-on-qsort-benchmarks-when-using-values-larger-than-10000/cstd/test/src/io/gitlab/mhammons/cstd/StdLibSuite.scala#L86
> > is
> > the test that crashes. You can run it by running ./mill cstd.test in a
> > cloned directory.
> >
> > My library is passing scala lambdas in by generating a lambda (Any, Any)
> =>
> > Any that takes the input parameters from foreign and converts them into
> the
> > expected types, and converts the output of the original lambda into a
> > foreign compatible type. This generated lambda is then bound to a method
> > handle by Using a findVirtual lookup of the appropriate function class,
> > describing the lambda to the MethodHandle system, and calling asType with
> > the method handle type that foreign is expecting.
> >
> > val lambdaMh: MethodHandle = MethodHandles.lookup
> > .findVirtual(
> > $classRepr,
> > "apply",
> > MT.genericMethodType(${ Expr(inputTypes.size) })
> > )
> > .bindTo($wrappedLambda)
> > .asType(methodType)
> >
> > Linker.linker.upcallStub(
> > lambdaMh,
> > functionDescriptor,
> > currentScope
> > )
> > This code is using macros to create the appropriate lambda types and
> such,
> > so it can be a bit hard to read. In any case, the method handle created
> > this way is then passed into upcallStub. I'm not sure if this is
> actually a
> > bug in my library, and I'd like your help in debugging this crash.
> >
> > Thanks so much,
> > Mark
>


More information about the panama-dev mailing list