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 with quarkus-infinispan-client and quarkus-grpc #12460

Closed
tbglazer opened this issue Oct 1, 2020 · 8 comments · Fixed by #12595
Closed

Native image build with quarkus-infinispan-client and quarkus-grpc #12460

tbglazer opened this issue Oct 1, 2020 · 8 comments · Fixed by #12595
Assignees
Labels
area/grpc gRPC area/infinispan Infinispan kind/bug Something isn't working
Milestone

Comments

@tbglazer
Copy link

tbglazer commented Oct 1, 2020

Describe the bug
When trying to build a native image using a docker container on Windows from an application that uses quarkus-infinispan-client and quarkus-grpc the buildfails with Error: Classes that should be initialized at run time got initialized during image building: with a list netty classes.

Expected behavior
The build succeeds.

Actual behavior
The build fails with a list of netty classes , also a lot of wildfly duplicates are listed before.

To Reproduce

Steps to reproduce the behavior:

  1. Generate project from https://code.quarkus.io/ with infinispan-client and gRPC
  2. Run in terminal : mvnw package -Pnative -Dquarkus.native.container-build=true

Configuration
application.properties is empty as generated

Screenshots

Environment (please complete the following information):

  • Output of uname -a or ver:
    Microsoft Windows [Version 10.0.19041.508]
  • Output of java -version:
    openjdk version "11.0.5" 2019-10-15
    OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
    OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)
  • GraalVM version (if different from Java):
    No GraalVM
  • Quarkus version or git rev:
    1.8.1.Final (but happens in previous releases also)
  • Build tool (ie. output of mvnw --version or gradlew --version):
    mvnw
    Additional context
    No additional context
@tbglazer tbglazer added the kind/bug Something isn't working label Oct 1, 2020
@quarkusbot
Copy link

@michalszynkiewicz
Copy link
Member

The error:

[INFO] --- quarkus-maven-plugin:1.8.1.Final:build (default) @ code-with-quarkus ---
[INFO] [org.jboss.threads] JBoss Threads version 3.1.1.Final
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /home/michal/job/quarkus/tmp/ispn-client-with-grpc/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Building native image from /home/michal/job/quarkus/tmp/ispn-client-with-grpc/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar/code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Checking image status quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11
20.2.0-java11: Pulling from quarkus/ubi-quarkus-native-image
Digest: sha256:cf227a4b0d428f8efaebc36defbc2abea2fb88b4ca78dce34bfcc93164a8e9ce
Status: Image is up to date for quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11
quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on GraalVM Version 20.2.0 (Java Version 11.0.8)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] docker run -v /home/michal/job/quarkus/tmp/ispn-client-with-grpc/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar:/project:z --env LANG=C --user 1000:1000 --rm quay.io/quarkus/ubi-quarkus-native-image:20.2.0-java11 -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dvertx.logger-delegate-factory-class-name=io.quarkus.vertx.core.runtime.VertxLogDelegateFactory -J-Dvertx.disableDnsResolver=true -J-Dio.netty.leakDetection.level=DISABLED -J-Dio.netty.allocator.maxOrder=1 -J-Duser.language=en -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https --enable-all-security-services --no-server -H:-UseServiceLoaderFeature -H:+StackTrace code-with-quarkus-1.0.0-SNAPSHOT-runner
mplayer ~/skrypty/break[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]    classlist:  15,563.23 ms,  1.19 GB
.mp3
[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]        (cap):   1,190.38 ms,  1.19 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]        setup:   4,987.65 ms,  1.19 GB
Already running
19:39:36,865 INFO  [org.jbo.threads] JBoss Threads version 3.1.1.Final
19:39:38,084 INFO  [org.inf.SECURITY] ISPN000947: Using Java SSL Provider
[code-with-quarkus-1.0.0-SNAPSHOT-runner:24]     analysis:  45,906.53 ms,  3.22 GB
Error: Classes that should be initialized at run time got initialized during image building:
 io.netty.channel.epoll.Epoll the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why io.netty.channel.epoll.Epoll got initialized use -H:+TraceClassInitialization
io.netty.util.AbstractReferenceCounted the class was requested to be initialized at run time (from the command line). To see why io.netty.util.AbstractReferenceCounted got initialized use -H:+TraceClassInitialization
io.netty.channel.DefaultFileRegion the class was requested to be initialized at run time (subtype of io.netty.util.AbstractReferenceCounted). To see why io.netty.channel.DefaultFileRegion got initialized use -H:+TraceClassInitialization
io.netty.channel.epoll.LinuxSocket the class was requested to be initialized at run time (subtype of io.netty.channel.unix.FileDescriptor). To see why io.netty.channel.epoll.LinuxSocket got initialized use -H:+TraceClassInitialization
io.netty.channel.epoll.Native the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why io.netty.channel.epoll.Native got initialized use -H:+TraceClassInitialization
io.netty.channel.unix.Socket the class was requested to be initialized at run time (subtype of io.netty.channel.unix.FileDescriptor). To see why io.netty.channel.unix.Socket got initialized use -H:+TraceClassInitialization
io.netty.channel.unix.FileDescriptor the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why io.netty.channel.unix.FileDescriptor got initialized use -H:+TraceClassInitialization

com.oracle.svm.core.util.UserError$UserException: Classes that should be initialized at run time got initialized during image building:
 io.netty.channel.epoll.Epoll the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why io.netty.channel.epoll.Epoll got initialized use -H:+TraceClassInitialization
io.netty.util.AbstractReferenceCounted the class was requested to be initialized at run time (from the command line). To see why io.netty.util.AbstractReferenceCounted got initialized use -H:+TraceClassInitialization
io.netty.channel.DefaultFileRegion the class was requested to be initialized at run time (subtype of io.netty.util.AbstractReferenceCounted). To see why io.netty.channel.DefaultFileRegion got initialized use -H:+TraceClassInitialization
io.netty.channel.epoll.LinuxSocket the class was requested to be initialized at run time (subtype of io.netty.channel.unix.FileDescriptor). To see why io.netty.channel.epoll.LinuxSocket got initialized use -H:+TraceClassInitialization
io.netty.channel.epoll.Native the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why io.netty.channel.epoll.Native got initialized use -H:+TraceClassInitialization
io.netty.channel.unix.Socket the class was requested to be initialized at run time (subtype of io.netty.channel.unix.FileDescriptor). To see why io.netty.channel.unix.Socket got initialized use -H:+TraceClassInitialization
io.netty.channel.unix.FileDescriptor the class was requested to be initialized at run time (from feature io.quarkus.runner.AutoFeature.beforeAnalysis). To see why io.netty.channel.unix.FileDescriptor got initialized use -H:+TraceClassInitialization

        at com.oracle.svm.core.util.UserError.abort(UserError.java:68)
        at com.oracle.svm.hosted.classinitialization.ConfigurableClassInitialization.checkDelayedInitialization(ConfigurableClassInitialization.java:526)
        at com.oracle.svm.hosted.classinitialization.ClassInitializationFeature.duringAnalysis(ClassInitializationFeature.java:227)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$runPointsToAnalysis$8(NativeImageGenerator.java:732)
        at com.oracle.svm.hosted.FeatureHandler.forEachFeature(FeatureHandler.java:70)
        at com.oracle.svm.hosted.NativeImageGenerator.runPointsToAnalysis(NativeImageGenerator.java:732)
        at com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:555)
        at com.oracle.svm.hosted.NativeImageGenerator.lambda$run$0(NativeImageGenerator.java:468)
        at java.base/java.util.concurrent.ForkJoinTask$AdaptedRunnableAction.exec(ForkJoinTask.java:1407)
        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)
Error: Image build request failed with exit status 1
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:34 min
[INFO] Finished at: 2020-10-05T21:39:52+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.8.1.Final:build (default) on project code-with-quarkus: Failed to build quarkus application: 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: java.lang.RuntimeException: Failed to build native image
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:343)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]         at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
[ERROR]         at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]         at java.base/java.lang.reflect.Method.invoke(Method.java:566)
[ERROR]         at io.quarkus.deployment.ExtensionLoader$2.execute(ExtensionLoader.java:936)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.ContextClassLoaderSavingRunnable.run(ContextClassLoaderSavingRunnable.java:35)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor.safeRun(EnhancedQueueExecutor.java:2046)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.doRunTask(EnhancedQueueExecutor.java:1578)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1452)
[ERROR]         at java.base/java.lang.Thread.run(Thread.java:834)
[ERROR]         at org.jboss.threads.JBossThread.run(JBossThread.java:479)
[ERROR] Caused by: java.lang.RuntimeException: Image generation failed. Exit code: 1
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:499)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:321)
[ERROR]         ... 12 more
[ERROR] -> [Help 1]
[ERROR] 
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR] 
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/MojoExecutionException

@michalszynkiewicz
Copy link
Member

Ispn client brings in

[INFO]    |  +- io.netty:netty-transport-native-epoll:jar:linux-x86_64:4.1.49.Final:compile
[INFO]    |  |  \- io.netty:netty-transport-native-unix-common:jar:4.1.49.Final:compile

@michalszynkiewicz
Copy link
Member

michalszynkiewicz commented Oct 5, 2020

@cescoffier I remember seeing some discussions about trying to add support for native-epoll to quarkus native. Is this correct?
If so, should we exclude native-epoll transport from the extensions that bring it in?
IIUC, native-epoll is a faster alternative to the NIO transport, so if it is excluded, Nio should kick in instead.

Here's how it's defined for ispn-hotrod-client:
https://github.com/infinispan/infinispan/blob/11.0.3.Final/client/hotrod-client/pom.xml#L58

@cescoffier
Copy link
Member

So far, epoll in native is not supported. @galderz is working on it and is making tremendous progress. However, still not there.

@cescoffier
Copy link
Member

BTW, we can't exclude the dependencies as it works perfectly well in JVM mode.

@michalszynkiewicz
Copy link
Member

michalszynkiewicz commented Oct 6, 2020

By we can't you mean that we would get worse performance in JVM mode on Linux and we don't want that, right?

So I guess we want a way to stop Netty from figuring out that epoll is available when it runs in the native mode, right?
I see this is how it's handled in the infinispan-client extension

@cescoffier
Copy link
Member

Exactly. We still want to support the epoll native transport in JVM mode. But in native mode, we need to be sure it's not enabled. In Vert.x, I have a substitution that disables it, we may need to do the same in gRPC.

michalszynkiewicz added a commit to michalszynkiewicz/quarkus that referenced this issue Oct 8, 2020
michalszynkiewicz added a commit to michalszynkiewicz/quarkus that referenced this issue Oct 8, 2020
@gsmet gsmet added this to the 1.8.3.Final milestone Oct 9, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 9, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Oct 10, 2020
@gsmet gsmet modified the milestones: 1.8.3.Final, 1.7.6.Final Nov 16, 2020
gsmet pushed a commit to gsmet/quarkus that referenced this issue Nov 16, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/grpc gRPC area/infinispan Infinispan kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

5 participants