question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.NullPointerException when using SQLite

See original GitHub issue

Describe the bug

Native compilation of a very small Quarkus app using SQLite causes an NPE in org.graalvm.compiler.java.BytecodeParser (full stack trace visible in the logs).

The bug report details are for Mac. I was also able to reproduce it using Linux (Linux lubu2 5.4.0-92-generic #103-Ubuntu SMP Fri Nov 26 16:13:00 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux)

Expected behavior

Native binary is built.

Actual behavior

NPE:

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM 21.3.0 Java 11 CE (Java Version 11.0.13+7-jvmci-21.3-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] docker run --env LANG=C --rm -v /test/quarkus-npe-test/target/quarkus-npe-1-native-image-source-jar:/project:z --name build-native-NnjXI quay.io/quarkus/ubi-quarkus-native-image:21.3-java11 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Duser.language=en -J-Duser.country=AU -J-Dfile.encoding=UTF-8 -H:-ParseOnce -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -J-Djava.awt.headless=true -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-UseServiceLoaderFeature -H:+StackTrace quarkus-npe-1-runner -jar quarkus-npe-1-runner.jar
[quarkus-npe-1-runner:26]    classlist:   5,765.12 ms,  0.96 GB
[quarkus-npe-1-runner:26]        (cap):   1,515.44 ms,  0.94 GB
[quarkus-npe-1-runner:26]        setup:   5,143.21 ms,  0.94 GB
02:19:16,604 INFO  [org.jbo.threads] JBoss Threads version 3.4.2.Final
[quarkus-npe-1-runner:26]     (clinit):     681.80 ms,  1.60 GB
[quarkus-npe-1-runner:26]   (typeflow):   7,008.22 ms,  1.60 GB
[quarkus-npe-1-runner:26]    (objects):  18,751.23 ms,  1.60 GB
[quarkus-npe-1-runner:26]   (features):   6,650.65 ms,  1.60 GB
[quarkus-npe-1-runner:26]     analysis:  34,451.37 ms,  1.60 GB
[quarkus-npe-1-runner:26]     universe:   2,445.88 ms,  1.60 GB
[quarkus-npe-1-runner:26]      (parse):   3,252.06 ms,  1.60 GB
[quarkus-npe-1-runner:26]      compile:   3,278.11 ms,  1.60 GB
2 fatal errors detected:
Fatal error:org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.NullPointerException
	at parsing org.sqlite.BusyHandler.<init>(BusyHandler.java:10)
	at method: void org.sqlite.BusyHandler.<init>()
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2624)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:107)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3485)
	at com.oracle.svm.hosted.phases.HostedBytecodeParser.iterateBytecodesForBlock(HostedGraphBuilderPhase.java:195)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3437)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3282)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1145)
	at com.oracle.svm.hosted.phases.HostedBytecodeParser.build(HostedGraphBuilderPhase.java:139)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:81)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:212)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.svm.hosted.code.CompileQueue.defaultParseFunction(CompileQueue.java:935)
	at com.oracle.svm.hosted.code.CompileQueue.doParse(CompileQueue.java:741)
	at com.oracle.svm.hosted.code.CompileQueue$ParseTask.run(CompileQueue.java:327)
	at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:188)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:172)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.NullPointerException
	at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.java.RegisterFinalizerNode.mayHaveFinalizer(RegisterFinalizerNode.java:105)
	at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.StandardGraphBuilderPlugins$34.apply(StandardGraphBuilderPlugins.java:988)
	at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.execute(InvocationPlugin.java:166)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.applyInvocationPlugin(BytecodeParser.java:2225)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.tryInvocationPlugin(BytecodeParser.java:2210)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.appendInvoke(BytecodeParser.java:1912)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeSpecial(BytecodeParser.java:1803)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeSpecial(BytecodeParser.java:1795)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5418)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3477)
	... 23 more
Fatal error:org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.NullPointerException
	at parsing org.sqlite.Collation.<init>(Collation.java:46)
	at method: void org.sqlite.Collation.<init>()
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.throwParserError(BytecodeParser.java:2624)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase$SharedBytecodeParser.throwParserError(SharedGraphBuilderPhase.java:107)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3485)
	at com.oracle.svm.hosted.phases.HostedBytecodeParser.iterateBytecodesForBlock(HostedGraphBuilderPhase.java:195)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.handleBytecodeBlock(BytecodeParser.java:3437)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBlock(BytecodeParser.java:3282)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.build(BytecodeParser.java:1145)
	at com.oracle.svm.hosted.phases.HostedBytecodeParser.build(HostedGraphBuilderPhase.java:139)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.buildRootMethod(BytecodeParser.java:1030)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.GraphBuilderPhase$Instance.run(GraphBuilderPhase.java:84)
	at com.oracle.svm.hosted.phases.SharedGraphBuilderPhase.run(SharedGraphBuilderPhase.java:81)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.run(Phase.java:49)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.BasePhase.apply(BasePhase.java:212)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:42)
	at jdk.internal.vm.compiler/org.graalvm.compiler.phases.Phase.apply(Phase.java:38)
	at com.oracle.svm.hosted.code.CompileQueue.defaultParseFunction(CompileQueue.java:935)
	at com.oracle.svm.hosted.code.CompileQueue.doParse(CompileQueue.java:741)
	at com.oracle.svm.hosted.code.CompileQueue$ParseTask.run(CompileQueue.java:327)
	at com.oracle.graal.pointsto.util.CompletionExecutor.executeCommand(CompletionExecutor.java:188)
	at com.oracle.graal.pointsto.util.CompletionExecutor.lambda$executeService$0(CompletionExecutor.java:172)
	at java.base/java.util.concurrent.ForkJoinTask$RunnableExecuteAction.exec(ForkJoinTask.java:1426)
	at java.base/java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:290)
	at java.base/java.util.concurrent.ForkJoinPool$WorkQueue.topLevelExec(ForkJoinPool.java:1020)
	at java.base/java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1656)
	at java.base/java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1594)
	at java.base/java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:183)
Caused by: java.lang.NullPointerException
	at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.java.RegisterFinalizerNode.mayHaveFinalizer(RegisterFinalizerNode.java:105)
	at jdk.internal.vm.compiler/org.graalvm.compiler.replacements.StandardGraphBuilderPlugins$34.apply(StandardGraphBuilderPlugins.java:988)
	at jdk.internal.vm.compiler/org.graalvm.compiler.nodes.graphbuilderconf.InvocationPlugin.execute(InvocationPlugin.java:166)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.applyInvocationPlugin(BytecodeParser.java:2225)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.tryInvocationPlugin(BytecodeParser.java:2210)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.appendInvoke(BytecodeParser.java:1912)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeSpecial(BytecodeParser.java:1803)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.genInvokeSpecial(BytecodeParser.java:1795)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.processBytecode(BytecodeParser.java:5418)
	at jdk.internal.vm.compiler/org.graalvm.compiler.java.BytecodeParser.iterateBytecodesForBlock(BytecodeParser.java:3477)
	... 23 more
[quarkus-npe-1-runner:26]      [total]:  53,327.56 ms,  1.60 GB
# Printing build artifacts to: /project/quarkus-npe-1-runner.build_artifacts.txt
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:07 min
[INFO] Finished at: 2022-01-12T13:19:44+11:00

How to Reproduce?

  1. Clone https://github.com/sesponda/quarkus-npe-test
  2. Execute ./mvnw clean package -Pnative -Dquarkus.native.container-build=true

Note: using -Dquarkus.native.builder-image=quay.io/quarkus/ubi-quarkus-mandrel:21.3-java11 also fails with the same NPE.

Output of uname -a or ver

Darwin C02DQ1BTMD6V 20.6.0 Darwin Kernel Version 20.6.0: Wed Nov 10 22:23:07 PST 2021; root:xnu-7195.141.14~1/RELEASE_X86_64 x86_64

Output of java -version

java version “17.0.1” 2021-10-19 LTS Java™ SE Runtime Environment (build 17.0.1+12-LTS-39) Java HotSpot™ 64-Bit Server VM (build 17.0.1+12-LTS-39, mixed mode, sharing)

GraalVM version (if different from Java)

ubi-quarkus-mandrel:21.3-java11

Quarkus version or git rev

2.6.2.Final

Build tool (ie. output of mvnw --version or gradlew --version)

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: /Users/sesponda/.m2/wrapper/dists/apache-maven-3.8.4-bin/52ccbt68d252mdldqsfsn03jlf/apache-maven-3.8.4 Java version: 17.0.1, vendor: Oracle Corporation, runtime: /Users/sesponda/.sdkman/candidates/java/17.0.1-oracle Default locale: en_AU, platform encoding: UTF-8 OS name: “mac os x”, version: “11.6.2”, arch: “x86_64”, family: “mac”

Additional information

No response

Issue Analytics

  • State:closed
  • Created 2 years ago
  • Reactions:1
  • Comments:10 (8 by maintainers)

github_iconTop GitHub Comments

1reaction
Sannecommented, Jan 12, 2022

@sesponda thanks for the context!

1reaction
zakkakcommented, Jan 12, 2022

As per this code comment, the only negative effect is more memory consumption during the build time.

Correct, and that’s even not always true. So if you are not hitting any memory limits you should be OK.

I’m happy to close this ticket. Thank you for the prompt help.

I would prefer keeping this open till the upstream issue is fixed and Quarkus defaults to a GraalVM version that includes that fix.

Read more comments on GitHub >

github_iconTop Results From Across the Web

org.graalvm.compiler.java.BytecodeParser ... - GitHub
compiler.java.BytecodeParser$BytecodeParserError: java.lang.NullPointerException with SQLite #27271.
Read more >
GraalVM Java on truffle - NullPointerException from ...
Sulong is a high-performance LLVM bitcode interpreter for GraalVM. The idea is to compile the OpenJDK native libraries to LLVM bitcode and ...
Read more >
java.lang.NullPointerException jdbc sqlite - CodeRanch
i'm new to java ; i try to do a simple operation and i get null pointer exception. i try to connect sqlite...
Read more >
NullPointerException creating GraalVM native image
[error] Caused by: org.graalvm.compiler.java.BytecodeParser$BytecodeParserError: java.lang.NullPointerException.
Read more >
NullPointerException - Android Developers
Returns an array containing all of the exceptions that were suppressed, typically by the try -with-resources statement, in order to deliver this exception....
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found