oracle / graal

GraalVM compiles Java applications into native executables that start instantly, scale fast, and use fewer compute resources 🚀
https://www.graalvm.org
Other
20.4k stars 1.64k forks source link

native-image crashing ArrayStoreException whilst compiling spring vanilla-tx sample #2199

Closed aclement closed 4 years ago

aclement commented 4 years ago

Describe GraalVM and your environment :

cc -v
Apple LLVM version 10.0.1 (clang-1001.0.46.4)
Target: x86_64-apple-darwin18.6.0
Thread model: posix
InstalledDir: /Library/Developer/CommandLineTools/usr/bin
cc -Wl,-v
@(#)PROGRAM:ld  PROJECT:ld64-450.3
BUILD 18:16:53 Apr  5 2019
configured to support archs: armv6 armv7 armv7s arm64 arm64e arm64_32 i386 x86_64 x86_64h armv6m armv7k armv7m armv7em
Library search paths:
    /usr/local/lib
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/usr/lib
Framework search paths:
    /Library/Developer/CommandLineTools/SDKs/MacOSX10.14.sdk/System/Library/Frameworks/
Undefined symbols for architecture x86_64:
  "_main", referenced from:
     implicit entry/start for main executable
ld: symbol(s) not found for architecture x86_64
clang: error: linker command failed with exit code 1 (use -v to see invocation)

Have you verified this issue still happens when using the latest snapshot? You can find snapshot builds here: https://github.com/graalvm/graalvm-ce-dev-builds/releases

Describe the issue Building my app crashes:

[vanilla-tx:14119]     analysis:  43,741.30 ms,  7.18 GB
Fatal error:java.lang.ArrayStoreException
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:423)
    at java.util.concurrent.ForkJoinTask.getThrowableException(ForkJoinTask.java:598)
    at java.util.concurrent.ForkJoinTask.get(ForkJoinTask.java:1005)
    at com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:456)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:358)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:517)
    at com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:116)
Caused by: java.lang.ArrayStoreException: sun.reflect.annotation.TypeNotPresentExceptionProxy
    at sun.reflect.annotation.AnnotationParser.parseClassArray(AnnotationParser.java:724)
    at sun.reflect.annotation.AnnotationParser.parseArray(AnnotationParser.java:531)
    at sun.reflect.annotation.AnnotationParser.parseMemberValue(AnnotationParser.java:355)
    at sun.reflect.annotation.AnnotationParser.parseAnnotation2(AnnotationParser.java:286)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations2(AnnotationParser.java:120)
    at sun.reflect.annotation.AnnotationParser.parseAnnotations(AnnotationParser.java:72)
    at java.lang.Class.createAnnotationData(Class.java:3521)
    at java.lang.Class.annotationData(Class.java:3510)
    at java.lang.Class.getAnnotations(Class.java:3446)
    at com.oracle.svm.hosted.config.JAXBClassAndResourcesLoaderFeature.registerAnnotatedXMLRootClasses(JAXBClassAndResourcesLoaderFeature.java:90)
    at com.oracle.svm.hosted.config.JAXBClassAndResourcesLoaderFeature.registerJavaxXmlConfigs(JAXBClassAndResourcesLoaderFeature.java:64)
    at com.oracle.svm.hosted.ReachabilityHandlerFeature.duringAnalysis(ReachabilityHandlerFeature.java:114)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$8(NativeImageGenerator.java:716)
    at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:63)
    at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:716)
    at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:531)
    at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:446)
    at java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1386)
    at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289)
    at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:1056)
    at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1692)
    at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)
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:1527)
    at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1289)
    at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1250)
    at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1209)

Describe the full native-image command

Capture full native-image command by running with the `--verbose` flag e.g.: ``` native-image \ --verbose \ --no-server \ -Dverbose=true \ --no-fallback \ -H:+TraceClassInitialization \ -H:Name=$ARTIFACT \ -H:+ReportExceptionStackTraces \ --allow-incomplete-classpath \ --report-unsupported-elements-at-runtime \ -DremoveUnusedAutoconfig=true \ -cp $CP $MAINCLASS ```
Due to feature verbose output this is massive, I'd need to do a bit of work to trim it down. It happens reliably though.

Code snippet or code repository that reproduces the issue

git clone git@github.com:spring-projects-experimental/spring-graal-native.git
git checkout extensible-configuration
cd spring-graal-native
./build-feature.sh
cd *samples/vanilla-tx
./build.sh

This works fine on 20.0 release.

eginez commented 4 years ago

Hey @aclement we have identified the issue in src/com/oracle/svm/hosted/config/JAXBClassAndResourcesLoaderFeature.java @arodionov is in the process of finding a fix for this, including a possible rollback of Feature.

eginez commented 4 years ago

Fixed by https://github.com/oracle/graal/commit/5ce84f4f975128c3dc28d2e4d9b61bd0274c9b35