typelevel / typelevel/skunk

graalvm native-image error

Open
#623 5 comments 2 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Dominant language
Scala
Stars
1.7k
Forks
175
Avg merge
5d 14h
Merged PRs (30d)
9

Description

I'm trying out Skunk with graalvm's native-image feature. It's failing and I've narrowed it down to when I call Session.prepare. I've also noticed that Metals can't get any info on that function when hovering over it, perhaps these problems are related?

The error from GraalVM is below.

I took a look at Skunk source code to see if I could find anything obvious that might be causing the error and all I can think is that there appears to be some cross compilation going on here, is there anything loading classes at runtime based on the platform or anything? GraalVM really dislikes that for obvious reasons.

It would be absolutely amazing to get Skunk working in a native image. All the other database libraries rely on JDBC and I haven't been able to get them to work.

#13 84.97 Fatal error:java.lang.InternalError: Enclosing method not found
#13 84.98       at java.base/java.lang.Class.getEnclosingMethod(Class.java:1296)
#13 84.98       at java.base/sun.reflect.generics.scope.ClassScope.computeEnclosingScope(ClassScope.java:50)
#13 84.98       at java.base/sun.reflect.generics.scope.AbstractScope.getEnclosingScope(AbstractScope.java:77)
#13 84.98       at java.base/sun.reflect.generics.scope.AbstractScope.lookup(AbstractScope.java:95)
#13 84.98       at java.base/sun.reflect.generics.factory.CoreReflectionFactory.findTypeVariable(CoreReflectionFactory.java:110)
#13 84.98       at java.base/sun.reflect.generics.visitor.Reifier.visitTypeVariableSignature(Reifier.java:165)
#13 84.99       at java.base/sun.reflect.generics.tree.TypeVariableSignature.accept(TypeVariableSignature.java:43)
#13 84.99       at java.base/sun.reflect.generics.visitor.Reifier.reifyTypeArguments(Reifier.java:68)
#13 84.99       at java.base/sun.reflect.generics.visitor.Reifier.visitClassTypeSignature(Reifier.java:138)
#13 84.99       at java.base/sun.reflect.generics.tree.ClassTypeSignature.accept(ClassTypeSignature.java:49)
#13 84.99       at java.base/sun.reflect.generics.repository.ClassRepository.computeSuperInterfaces(ClassRepository.java:117)
#13 84.99       at java.base/sun.reflect.generics.repository.ClassRepository.getSuperInterfaces(ClassRepository.java:95)
#13 84.99       at java.base/java.lang.Class.getGenericInterfaces(Class.java:1137)
#13 84.99       at com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.fillGenericInfo(NativeImagePointsToAnalysis.java:343)
#13 84.99       at com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.checkType(NativeImagePointsToAnalysis.java:140)
#13 84.99       at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
#13 84.99       at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
#13 84.99       at java.base/java.util.AbstractList$RandomAccessSpliterator.forEachRemaining(AbstractList.java:720)
#13 84.99       at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
#13 85.00       at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
#13 85.00       at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
#13 85.00       at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
#13 85.00       at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
#13 85.00       at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
#13 85.00       at com.oracle.svm.hosted.analysis.NativeImagePointsToAnalysis.checkObjectGraph(NativeImagePointsToAnalysis.java:125)
#13 85.00       at com.oracle.graal.pointsto.PointsToAnalysis.checkObjectGraph(PointsToAnalysis.java:676)
#13 85.00       at com.oracle.graal.pointsto.PointsToAnalysis.finish(PointsToAnalysis.java:644)
#13 85.00       at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:704)
#13 85.00       at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:529)
#13 85.00       at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:488)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:403)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:569)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:122)
#13 85.00       at com.oracle.svm.hosted.NativeImageGeneratorRunner$JDK9Plus.main(NativeImageGeneratorRunner.java:599)
#13 85.00 [accuheat3:25]      [total]:  83,712.94 ms,  2.26 GB
#13 85.02 # Printing build artifacts to: /app/accuheat3.build_artifacts.txt
#13 85.97 Error: Image build request failed with exit status 1
#13 85.97 com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
#13 85.98       at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1762)
#13 85.98       at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1473)
#13 85.98       at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1434)
#13 85.98       at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1421)

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by reproducing the GraalVM native-image failure around Session.prepare and inspect the Enclosing method not found stack trace, including NativeImagePointsToAnalysis. Determine whether Skunk can build and run as a native image, with Session.prepare working without the reported error.

Written by the indexing model from the issue text.

Assessment

Tech stack
postgres, scala
Domain
database
Issue type
Bug
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.