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

Native Image Build fails after upgrade to 3.2.3.Final #35289

Closed
sreekanth-pricer opened this issue Aug 9, 2023 · 10 comments
Closed

Native Image Build fails after upgrade to 3.2.3.Final #35289

sreekanth-pricer opened this issue Aug 9, 2023 · 10 comments
Labels
area/container-image area/mandrel kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.

Comments

@sreekanth-pricer
Copy link

sreekanth-pricer commented Aug 9, 2023

Describe the bug

The native image build is failed when it is built using jib and always gives the below error. Works well when i downgrade to 3.0.3 Final.

Expected behavior

The native image should be built.

Actual behavior

[1/8] Initializing...                                                                                   (25.9s @ 0.40GB)
 Java version: 17.0.8+7, vendor version: Mandrel-23.0.1.2-Final
 Graal compiler: optimization level: 2, target machine: x86-64-v3
 C compiler: gcc (redhat, x86_64, 8.5.0)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 10 user-specific feature(s)
 - com.google.api.gax.grpc.nativeimage.GrpcNettyFeature
 - com.google.api.gax.grpc.nativeimage.ProtobufMessageFeature
 - com.google.api.gax.nativeimage.GoogleJsonClientFeature
 - com.google.api.gax.nativeimage.OpenCensusFeature
 - com.oracle.svm.thirdparty.gson.GsonFeature
 - io.quarkus.awt.runtime.graal.DarwinAwtFeature
 - io.quarkus.hibernate.validator.runtime.DisableLoggingFeature: Disables INFO logging during the analysis phase for the [org.hibernate.validator.internal.util.Version] categories
 - io.quarkus.runner.Feature: Auto-generated class by Quarkus from the existing extensions
 - io.quarkus.runtime.graal.DisableLoggingFeature: Disables INFO logging during the analysis phase
 - org.eclipse.angus.activation.nativeimage.AngusActivationFeature
Warning: RecomputeFieldValue.FieldOffset automatic substitution failed. The automatic substitution registration was attempted because a call to sun.misc.Unsafe.objectFieldOffset(Field) was detected in the static initializer of com.google.protobuf.UnsafeUtil. Detailed failure reason(s): The argument of sun.misc.Unsafe.objectFieldOffset(java.lang.reflect.Field) is not a constant value or a field load that can be constant-folded., Could not determine the field where the value produced by the call to sun.misc.Unsafe.objectFieldOffset(Field) for the field offset computation is stored. The call is not directly followed by a field store or by a sign extend node followed directly by a field store. 
[2/8] Performing analysis...  []                                                                       (191.7s @ 1.79GB)
  19,535 (90.58%) of 21,567 types reachable
  31,537 (63.40%) of 49,740 fields reachable
 104,483 (65.24%) of 160,156 methods reachable
   5,825 types, 1,301 fields, and 7,088 methods registered for reflection

------------------------------------------------------------------------------------------------------------------------
                       37.9s (17.3% of total time) in 84 GCs | Peak RSS: 3.18GB | CPU load: 1.92
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /project/svm_err_b_20230809T135424.417_pid53.md (build_info)
========================================================================================================================
Failed generating 'my-service-0.0.47-vast459fixfontissue.23.e732316-runner' after 3m 38s.

The build process encountered an unexpected error:

java.lang.NullPointerException: Cannot invoke "java.util.Set.iterator()" because "triggers" is null
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ReachabilityHandlerFeature.processReachable(ReachabilityHandlerFeature.java:173)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ReachabilityHandlerFeature.duringAnalysis(ReachabilityHandlerFeature.java:128)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$10(NativeImageGenerator.java:770)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:86)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$11(NativeImageGenerator.java:770)
	at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.AbstractAnalysisEngine.runAnalysis(AbstractAnalysisEngine.java:179)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:767)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:582)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.run(NativeImageGenerator.java:539)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:[408](https://github.com/PricerAB/vas-asset-service/actions/runs/5809900938/job/15749648061#step:10:412))
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.build(NativeImageGeneratorRunner.java:612)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.start(NativeImageGeneratorRunner.java:134)
	at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.main(NativeImageGeneratorRunner.java:94)


> Task :quarkusAppPartsBuild FAILED


Deprecated Gradle features were used in this build, making it incompatible with Gradle 9.0.

FAILURE: Build failed with an exception.
You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.


* What went wrong:
Execution failed for task ':quarkusAppPartsBuild'.
> There was a failure while executing work items
   > A failure occurred while executing io.quarkus.gradle.tasks.worker.BuildWorker
      > io.quarkus.builder.BuildException: Build failure: Build failed due to errors
Error:         	[error]: Build step io.quarkus.deployment.pkg.steps.NativeImageBuildStep#build threw an exception: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
        	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:[457](https://github.com/PricerAB/vas-asset-service/actions/runs/5809900938/job/15749648061#step:10:461))
        	at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:263)
        	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
        	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        	at java.base/java.lang.reflect.Method.invoke(Method.java:568)
        	at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:864)
        	at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
        	at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
        	at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
        	at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
        	at java.base/java.lang.Thread.run(Thread.java:833)
        	at org.jboss.threads.JBossThread.run(JBossThread.java:501)

How to Reproduce?

No response

Output of uname -a or ver

No response

Output of java -version

17

GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.2.3.Final

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

gradle 8.2

Additional information

No response

@quarkus-bot
Copy link

quarkus-bot bot commented Aug 9, 2023

/cc @Karm (mandrel), @galderz (mandrel), @geoand (jib), @zakkak (mandrel)

@gastaldi gastaldi added the triage/needs-reproducer We are waiting for a reproducer. label Aug 10, 2023
@gastaldi
Copy link
Contributor

Can you attach a reproducer?

@galderz
Copy link
Member

galderz commented Aug 11, 2023

Hmmm, the same NPE seems to have appeared before, see apache/camel-quarkus#5006 (comment).

Can you try Foivos' suggestion to that issue apache/camel-quarkus#5006 (comment)? Bear in mind the specific details Foivos provides there, in the context of apache/camel-quarkus#5006 (comment).

@galderz
Copy link
Member

galderz commented Aug 11, 2023

FYI @zakkak

@sreekanth-pricer
Copy link
Author

The build passes sometime after adding the native image arg Args = -H:+RunReachabilityHandlersConcurrently. This is very inconsistent

@galderz
Copy link
Member

galderz commented Aug 14, 2023

@sreekanth-pricer Ok. As rightly noted by @gastaldi, we would need a reproducer to better understand why the workaround from @zakkak is not fully working in your case.

@ebullient
Copy link
Member

oracle/graal#5868 ?

@sreekanth-pricer
Copy link
Author

sreekanth-pricer commented Aug 17, 2023

I suspect it could be because of the google dependencies we use . I have the below ones. The interesting part is it succeeds when i re run the same build few times.
implementation "io.quarkiverse.googlecloudservices:quarkus-google-cloud-secret-manager:${quarkiverseGoogleCloudServicesVersion}" implementation ("com.google.cloud:google-cloud-storage:${googleCloudStorageVersion}"){ // Exclusion needed for native build to work: exclude group: "io.grpc", module: "grpc-netty-shaded" } implementation ("com.google.auth:google-auth-library-oauth2-http:${googleAuthVersion}"){ // Exclusion needed for native build to work: exclude group: "io.grpc", module: "grpc-netty-shaded" } // commons-logging-jboss-logging is needed so that the quarkus-google-cloud-secret-manager dependency doesn't try to use org.apache.commons.logging.impl.LogFactoryImpl in native mode implementation "org.jboss.logging:commons-logging-jboss-logging:${jbossLoggingVersion}" implementation("com.google.cloud:google-cloud-datastore:${googleCloudDatastoreVersion}") { // Exclusion needed for native build to work: exclude group: "io.grpc", module: "grpc-netty-shaded" }

@Karm
Copy link
Member

Karm commented Aug 21, 2023

A reproducer is needed.

@geoand
Copy link
Contributor

geoand commented Sep 4, 2023

Closing for lack of feedback

@geoand geoand closed this as not planned Won't fix, can't repro, duplicate, stale Sep 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/container-image area/mandrel kind/bug Something isn't working triage/needs-reproducer We are waiting for a reproducer.
Projects
None yet
Development

No branches or pull requests

6 participants