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

Incompatible change of initialization policy for java.io.RandomAccessFile #2901

Closed
mipastgt opened this issue Oct 6, 2020 · 4 comments
Closed
Assignees

Comments

@mipastgt
Copy link

mipastgt commented Oct 6, 2020

Describe the issue
When I build an application of mine via Gluons client-maven-plugin (JavaFX toolchain, but probably not relevant to this issue) I get the following exception at the end of the native-image build:

[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] Error: Incompatible change of initialization policy for java.io.RandomAccessFile: trying to change RERUN for JDK native code support via JNI to BUILD_TIME super type of org.apache.fontbox.ttf.BufferedRandomAccessFile
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] com.oracle.svm.core.util.UserError$UserException: Incompatible change of initialization policy for java.io.RandomAccessFile: trying to change RERUN for JDK native code support via JNI to BUILD_TIME super type of org.apache.fontbox.ttf.BufferedRandomAccessFile
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:99)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insertRec(ClassInitializationConfiguration.java:113)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationConfiguration.insert(ClassInitializationConfiguration.java:64)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.forceInitializeHosted(ConfigurableClassInitialization.java:472)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.forceInitializeHosted(ConfigurableClassInitialization.java:476)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.lambda$initializeSafeDelayedClasses$11(ClassInitializationFeature.java:319)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.accept(ForEachOps.java:183)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.ReferencePipeline$2$1.accept(ReferencePipeline.java:177)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.HashMap$KeySpliterator.forEachRemaining(HashMap.java:1603)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.AbstractPipeline.copyInto(AbstractPipeline.java:484)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.AbstractPipeline.wrapAndCopyInto(AbstractPipeline.java:474)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.ForEachOps$ForEachOp.evaluateSequential(ForEachOps.java:150)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.ForEachOps$ForEachOp$OfRef.evaluateSequential(ForEachOps.java:173)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.AbstractPipeline.evaluate(AbstractPipeline.java:234)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.stream.ReferencePipeline.forEach(ReferencePipeline.java:497)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.initializeSafeDelayedClasses(ClassInitializationFeature.java:316)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.afterAnalysis(ClassInitializationFeature.java:256)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$9(NativeImageGenerator.java:753)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:753)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] Error: Image build request failed with exit status 1
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] com.oracle.svm.driver.NativeImage$NativeImageError: Image build request failed with exit status 1
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.driver.NativeImage.showError(NativeImage.java:1558)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.driver.NativeImage.build(NativeImage.java:1308)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.driver.NativeImage.performBuild(NativeImage.java:1269)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.driver.NativeImage.main(NativeImage.java:1228)
[Di. Okt. 06 17:02:18 MESZ 2020][INFO] [SUB] 	at com.oracle.svm.driver.NativeImage$JDK9Plus.main(NativeImage.java:1740)

The problem seems to be in some external code inside of apaches PDFBox (2.0.20) which I am using in my program.

Describe GraalVM and your environment:

  • GraalVM version graalvm-ce-java11-20.2.0
  • JDK major version: 11
  • OS: macOS Mojava 10.14.6
  • Architecture: AMD64
@fernando-valdez
Copy link
Member

Hello @mipastgt,
Thanks for reporting this issue.
Can you please share a reproducer?

@mipastgt
Copy link
Author

mipastgt commented Oct 7, 2020

Here is a trivial and tiny example maven project which reproduces the issue.
Just call mvn clean package to reproduce the bug.
PDFBoxBugReport.zip
I hope this helps to fix the problem.

@mipastgt
Copy link
Author

Does a similar fix like in this issue #1462 also apply here?

@fernando-valdez
Copy link
Member

Hello @mipastgt,
I tested again the reproducer, but this time I used GraalVM 21.1.0 Java 11. The problem seems to be fixed in this version.
I also removed the following flags from the pom file: -H:+TraceClassInitialization -H:+IncludeAllTimeZones

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