Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Build fails while when xodus is being used #2654

Closed
asm0dey opened this issue Jul 5, 2020 · 1 comment
Closed

Build fails while when xodus is being used #2654

asm0dey opened this issue Jul 5, 2020 · 1 comment
Assignees

Comments

@asm0dey
Copy link

asm0dey commented Jul 5, 2020

Describe the issue
When I'm trying to build github.com/asm0dey/lutik.rss shaded jar with native image I'm getting error (below)

Steps to reproduce the issue
Please include both build steps as well as run steps

  1. git clone --depth 1 [email protected]:asm0dey/lutik.rss.git
  2. ./gradlew build
  3. native-image -cp build/libs/lutik-rss-generator-1.0.8-all.jar --no-fallback generator.MainKt

Describe GraalVM and your environment:

  • OpenJDK 64-Bit Server VM GraalVM CE 20.1.0 (build 11.0.7+10-jvmci-20.1-b02, mixed mode, sharing)
  • 11
  • Linux UNIT-1793 5.6.16-1-MANJARO Feature/instrumentation api #1 SMP PREEMPT Wed Jun 3 14:26:28 UTC 2020 x86_64 GNU/Linux

More details

❯ native-image -cp build/libs/lutik-rss-generator-1.0.8-all.jar --no-fallback  --native-image-info --verbose generator.MainKt
Build on Server(pid: 810918, port: 40081)
SendBuildRequest [
-task=com.oracle.svm.hosted.NativeImageGeneratorRunner
-imagecp
/usr/lib/jvm/java-11-graalvm/lib/svm/builder/svm-llvm.jar:/usr/lib/jvm/java-11-graalvm/lib/svm/builder/svm.jar:/usr/lib/jvm/java-11-graalvm/lib/svm/builder/objectfile.jar:/usr/lib/jvm/java-11-graalvm/lib/svm/builder/llvm-platform-specific-shadowed.jar:/usr/lib/jvm/java-11-graalvm/lib/svm/builder/javacpp-shadowed.jar:/usr/lib/jvm/java-11-graalvm/lib/svm/builder/llvm-wrapper-shadowed.jar:/usr/lib/jvm/java-11-graalvm/lib/svm/builder/pointsto.jar:/usr/lib/jvm/java-11-graalvm/lib/svm/library-support.jar:/home/finkel/work_self/lutik.rss/build/libs/lutik-rss-generator-1.0.8-all.jar
-H:Path=/home/finkel/work_self/lutik.rss
-H:FallbackThreshold=0
-H:+DumpTargetInfo
-H:CLibraryPath=/usr/lib/jvm/java-11-graalvm/lib/svm/clibraries/linux-amd64
-H:Class=generator.MainKt
-H:Name=generator.mainkt
]
[generator.mainkt:810918]    classlist:   2,271.88 ms,  2.48 GB
[generator.mainkt:810918]        (cap):     503.93 ms,  2.48 GB
[generator.mainkt:810918]        setup:     714.51 ms,  2.48 GB
# Building image for target platform: org.graalvm.nativeimage.Platform$LINUX_AMD64
# Using native toolchain:
#   Name: GNU project C and C++ compiler (gcc)
#   Vendor: pc
#   Version: 10.1.0
#   Target architecture: x86_64
#   Path: /usr/bin/gcc
# Using CLibrary: com.oracle.svm.core.c.libc.GLibc
[generator.mainkt:810918]     (clinit):     250.17 ms,  2.54 GB
# Static libraries:
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/svm/clibraries/linux-amd64/liblibchelper.a
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/libnet.a
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/svm/clibraries/linux-amd64/libstrictmath.a
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/svm/clibraries/linux-amd64/libffi.a
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/libnio.a
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/libjava.a
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/svm/clibraries/linux-amd64/libjvm.a
#   ../../../../../../usr/lib/jvm/java-11-graalvm/lib/libzip.a
# Other libraries: pthread,dl,z,rt
[generator.mainkt:810918]   (typeflow):   5,507.84 ms,  2.54 GB
[generator.mainkt:810918]    (objects):   7,713.56 ms,  2.54 GB
[generator.mainkt:810918]   (features):     180.39 ms,  2.54 GB
[generator.mainkt:810918]     analysis:  14,146.06 ms,  2.54 GB
Error: Unsupported features in 6 methods
Detailed message:
Error: No instances of sun.nio.ch.FileChannelImpl are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use -H:+TraceClassInitialization.
Trace: Object was reached by 
        reading field java.nio.channels.FileLock.channel of
                constant sun.nio.ch.FileLockImpl@1ce380bb reached by 
        reading field java.lang.ref.Reference.referent of
                constant sun.nio.ch.FileLockTable$FileLockReference@522c516a reached by 
        indexing into array
                constant java.lang.Object[]@228534ea reached by 
        reading field java.util.ArrayList.elementData of
                constant java.util.ArrayList@522c5189 reached by 
        reading field java.util.concurrent.ConcurrentHashMap$Node.val of
                constant java.util.concurrent.ConcurrentHashMap$Node@533aafa1 reached by 
        indexing into array
                constant java.util.concurrent.ConcurrentHashMap$Node[]@23f56ade reached by 
        reading field java.util.concurrent.ConcurrentHashMap.table of
                constant java.util.concurrent.ConcurrentHashMap@533aafa1 reached by 
        reading field sun.nio.ch.FileLockTable.lockMap
Error: No instances of sun.nio.ch.FileKey are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use -H:+TraceClassInitialization.
Trace: Object was reached by 
        reading field java.util.concurrent.ConcurrentHashMap$Node.key of
                constant java.util.concurrent.ConcurrentHashMap$Node@533aafa1 reached by 
        indexing into array
                constant java.util.concurrent.ConcurrentHashMap$Node[]@23f56ade reached by 
        reading field java.util.concurrent.ConcurrentHashMap.table of
                constant java.util.concurrent.ConcurrentHashMap@533aafa1 reached by 
        reading field sun.nio.ch.FileLockTable.lockMap
Error: No instances of sun.nio.ch.FileKey are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use -H:+TraceClassInitialization.
Trace: Object was reached by 
        reading field sun.nio.ch.FileLockTable$FileLockReference.fileKey of
                constant sun.nio.ch.FileLockTable$FileLockReference@522c516a reached by 
        indexing into array
                constant java.lang.Object[]@228534ea reached by 
        reading field java.util.ArrayList.elementData of
                constant java.util.ArrayList@522c5189 reached by 
        reading field java.util.concurrent.ConcurrentHashMap$Node.val of
                constant java.util.concurrent.ConcurrentHashMap$Node@533aafa1 reached by 
        indexing into array
                constant java.util.concurrent.ConcurrentHashMap$Node[]@23f56ade reached by 
        reading field java.util.concurrent.ConcurrentHashMap.table of
                constant java.util.concurrent.ConcurrentHashMap@533aafa1 reached by 
        reading field sun.nio.ch.FileLockTable.lockMap
Error: com.oracle.graal.pointsto.constraints.UnsupportedFeatureException: Invoke with MethodHandle argument could not be reduced to at most a single call or single field access. The method handle must be a compile time constant, e.g., be loaded from a `static final` field. Method that contains the method handle invocation: java.lang.invoke.Invokers$Holder.linkToTargetMethod(Object, Object)
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The error is then reported at run time when the invoke is executed.
Trace: 
        at parsing java.lang.invoke.MethodHandles$Lookup.protectionDomain(MethodHandles.java:978)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.protectionDomain(Class): 
        at java.lang.invoke.MethodHandles$Lookup.protectionDomain(MethodHandles.java:978)
        at java.lang.invoke.MethodHandles$Lookup.lookupClassProtectionDomain(MethodHandles.java:972)
        at java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:960)
        at javassist.util.proxy.DefineClassHelper.toPublicClass(DefineClassHelper.java:267)
        at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:127)
        at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:552)
        at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:475)
        at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:444)
        at javassist.util.proxy.ProxyFactory.create(ProxyFactory.java:721)
        at kotlinx.dnq.util.XdHierarchyNode$naturalPersistentClassInstance$2.invoke(XdHierarchyNode.kt:96)
        at kotlinx.dnq.util.XdHierarchyNode$naturalPersistentClassInstance$2.invoke(XdHierarchyNode.kt:33)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at kotlin.SynchronizedLazyImpl.toString(LazyJVM.kt:84)
        at java.lang.String.valueOf(String.java:2951)
        at java.io.PrintStream.print(PrintStream.java:745)
        at java.io.PrintStream.println(PrintStream.java:882)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:759)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported method java.lang.ClassLoader.defineClass1(ClassLoader, String, byte[], int, int, ProtectionDomain, String) is reachable
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing java.lang.System$2.defineClass(System.java:2129)
Call path from entry point to java.lang.System$2.defineClass(ClassLoader, String, byte[], ProtectionDomain, String): 
        at java.lang.System$2.defineClass(System.java:2129)
        at java.lang.invoke.MethodHandles$Lookup.defineClass(MethodHandles.java:962)
        at javassist.util.proxy.DefineClassHelper.toPublicClass(DefineClassHelper.java:267)
        at javassist.util.proxy.FactoryHelper.toClass(FactoryHelper.java:127)
        at javassist.util.proxy.ProxyFactory.createClass3(ProxyFactory.java:552)
        at javassist.util.proxy.ProxyFactory.createClass1(ProxyFactory.java:475)
        at javassist.util.proxy.ProxyFactory.createClass(ProxyFactory.java:444)
        at javassist.util.proxy.ProxyFactory.create(ProxyFactory.java:721)
        at kotlinx.dnq.util.XdHierarchyNode$naturalPersistentClassInstance$2.invoke(XdHierarchyNode.kt:96)
        at kotlinx.dnq.util.XdHierarchyNode$naturalPersistentClassInstance$2.invoke(XdHierarchyNode.kt:33)
        at kotlin.SynchronizedLazyImpl.getValue(LazyJVM.kt:74)
        at kotlin.SynchronizedLazyImpl.toString(LazyJVM.kt:84)
        at java.lang.String.valueOf(String.java:2951)
        at java.io.PrintStream.print(PrintStream.java:745)
        at java.io.PrintStream.println(PrintStream.java:882)
        at com.oracle.svm.jni.functions.JNIFunctions.ExceptionDescribe(JNIFunctions.java:759)
        at com.oracle.svm.core.code.IsolateEnterStub.JNIFunctions_ExceptionDescribe_b5412f7570bccae90b000bc37855f00408b2ad73(generated:0)
Error: com.oracle.svm.hosted.substitute.DeletedElementException: Unsupported type java.lang.invoke.MemberName is reachable: All methods from java.lang.invoke should have been replaced during image building.
To diagnose the issue, you can add the option --report-unsupported-elements-at-runtime. The unsupported element is then reported at run time when it is accessed the first time.
Trace: 
        at parsing java.lang.invoke.MethodHandles$Lookup.unreflect(MethodHandles.java:1740)
Call path from entry point to java.lang.invoke.MethodHandles$Lookup.unreflect(Method): 
        at java.lang.invoke.MethodHandles$Lookup.unreflect(MethodHandles.java:1732)
        at javassist.util.proxy.SecurityActions$3.run(SecurityActions.java:95)
        at javassist.util.proxy.SecurityActions$3.run(SecurityActions.java:90)
        at com.oracle.svm.core.jdk.Target_java_security_AccessController.doPrivileged(SecuritySubstitutions.java:119)
        at jetbrains.exodus.util.UnsafeHolder.doPrivileged$xodus_utils(UnsafeHolder.kt:29)
        at jetbrains.exodus.util.SafeByteBufferCleaner.clean(SafeByteBufferCleaner.kt:49)
        at jetbrains.exodus.io.SharedMappedByteBuffer.close(SharedMappedByteBuffer.java:51)
        at java.io.FileDescriptor.closeAll(FileDescriptor.java:345)
        at java.io.FileInputStream.close(FileInputStream.java:373)
        at sun.nio.ch.FileChannelImpl.implCloseChannel(FileChannelImpl.java:193)
        at java.nio.channels.spi.AbstractInterruptibleChannel$1.interrupt(AbstractInterruptibleChannel.java:162)
        at java.lang.Thread.interrupt(Thread.java:993)
        at com.oracle.svm.core.thread.JavaThreads.threadStartRoutine(JavaThreads.java:514)
        at com.oracle.svm.core.posix.thread.PosixJavaThreads.pthreadStartRoutine(PosixJavaThreads.java:193)
        at com.oracle.svm.core.code.IsolateEnterStub.PosixJavaThreads_pthreadStartRoutine_e1f4a8c0039f8337338252cd8734f63a79b5e3df(generated:0)

Error: Use -H:+ReportExceptionStackTraces to print stacktrace of underlying exception
Error: Image build request failed with exit status 1
com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
        at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1541)
        at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1299)
        at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1260)
        at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1219)
        at com.oracle.svm.driver.NativeImage$JDK9Plus.main(NativeImage.java:1722)

@asm0dey asm0dey changed the title Build faile while when xodus is being used Build fails while when xodus is being used Jul 5, 2020
@cstancu
Copy link
Member

cstancu commented Sep 22, 2020

The underlying issue here is incomplete MethodHandle support. That is under development and is being tracked by #2761.

@cstancu cstancu closed this as completed Sep 22, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants