quarkusio / quarkus

Quarkus: Supersonic Subatomic Java.
https://quarkus.io
Apache License 2.0
13.82k stars 2.69k forks source link

Unable to build a native Linux executable without GraalVM installed #36754

Closed patr1kt0th closed 1 year ago

patr1kt0th commented 1 year ago

Describe the bug

Hi guys, I'm struggling (a lot) with building a native Linux executable on macOS (Sonoma 14.0). I can't complete the build with any of our microservices successfully, but I have the same issue with a "dummy" project generated via https://code.quarkus.io/, so I'll use this one for reference.

Please see the Actual behavior and How to Reproduce? sections for more details but basically, I'm unable to build a native Linux executable because of strange Too many open files and Feature ??? class not found on the classpath exceptions.

Thanks a lot for any kind of hints.

Expected behavior

All my colleagues running on Windows (11) and another colleague using macOS (Ventura 13.6) are able to build a native Linux executable, so instead of finishing the build with [INFO] BUILD FAILURE, I'd expect [INFO] BUILD SUCCESS.

Actual behavior

After running quarkus build --native --no-tests -Dnative.container-build=true -Dquarkus.native.container-runtime=podman I get:

[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< org.acme:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO]   from pom.xml
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- resources:3.3.1:resources (default-resources) @ code-with-quarkus ---
[INFO] Copying 2 resources from src/main/resources to target/classes
[INFO]
[INFO] --- quarkus:3.4.3:generate-code (default) @ code-with-quarkus ---
[INFO]
[INFO] --- compiler:3.11.0:compile (default-compile) @ code-with-quarkus ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus:3.4.3:generate-code-tests (default) @ code-with-quarkus ---
[INFO]
[INFO] --- resources:3.3.1:testResources (default-testResources) @ code-with-quarkus ---
[INFO] Not copying test resources
[INFO]
[INFO] --- compiler:3.11.0:testCompile (default-testCompile) @ code-with-quarkus ---
[INFO] Not compiling test sources
[INFO]
[INFO] --- surefire:3.1.2:test (default-test) @ code-with-quarkus ---
[INFO] Tests are skipped.
[INFO]
[INFO] --- jar:3.3.0:jar (default-jar) @ code-with-quarkus ---
[INFO]
[INFO] --- quarkus:3.4.3:build (default) @ code-with-quarkus ---
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building native image source jar: /Users/patriktoth/Dev/Quarkus/code-with-quarkus/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 /Users/patriktoth/Dev/Quarkus/code-with-quarkus/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.NativeImageBuildContainerRunner] Using podman to run the native image builder
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildContainerRunner] Checking status of builder image 'quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-17'
Trying to pull quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-17...
Getting image source signatures
Copying blob sha256:02e32f5d0b7fbbf7121719d5fcab5609a143811ef7c83e15e828eace4a8fc5d8
Copying blob sha256:fcb6b5867bcc27d8087ab179830375319b46ebba09a5ecc2fb85cbef198cb0b0
Copying blob sha256:d92f65e3b25ae5aa8f4558cedb9621f556cbc17f408eb79c29c3c0379e634a9f
Copying blob sha256:f2ab2891e8d5c21211d0f13a542ddf52b3b762217cb541a3ddcd7603411967ea
Copying blob sha256:4948ed8f8fc567ce801aa77ecc948cbf67c479727d7a3313753168dd3380c172
Copying blob sha256:01858fc5b53815a5246d56955a83c921bd53ca283cc1bfb67ea13a4fca0120fa
Copying blob sha256:902359ad9bdde0ba61d4435076197d41516347623424d76f0e3efbd426a25704
Copying blob sha256:28313163201eea090e947767841da0e243e2fb4353ba9f7ac559b21c5b4f8364
Copying blob sha256:d49a2fc1cd599d1dbcb91cc152aa0135ca0150b4a8809a2b588c0fea27977d93
Copying blob sha256:394cb0ccc4e0c9fb07365a1bf4289ac0e7376c654b800d91b1cf26c3b8fea521
Copying blob sha256:5f3c7f71c53a7dd8053decea04f185dbe3e1326d1f2f3973eb715042f28be1f0
Copying blob sha256:92da33547d7f2f1081b6c04081511d60f9ac61e9b3e7a01506288b1dfeb3cc41
Copying blob sha256:fbb527b1fea6b7e17ff334ec677f2bed421ab1e6a51f2d8bc7afe2dbc3f2a3fd
Copying blob sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
Copying blob sha256:4f4fb700ef54461cfa02571ae0db9a0dc1e0cdb5577484a6d75e68dc38e8acc1
Copying config sha256:4f388748e11557543cc594342b7e728adee1e0e8469b770e40c9ed887c30639f
Writing manifest to image destination
4f388748e11557543cc594342b7e728adee1e0e8469b770e40c9ed887c30639f
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] Running Quarkus native-image plugin on native-image 17.0.8 2023-07-18
OpenJDK Runtime Environment Mandrel-23.0.1.2-Final (build 17.0.8+7)
OpenJDK 64-Bit Server VM Mandrel-23.0.1.2-Final (build 17.0.8+7, mixed mode)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] podman run --env LANG=C --rm --user 501:20 --userns=keep-id -v /Users/patriktoth/Dev/Quarkus/code-with-quarkus/target/code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar:/project --name build-native-CTRxn quay.io/quarkus/ubi-quarkus-mandrel-builder-image:jdk-17 -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -J-Dlogging.initial-configurator.min-level=500 -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=3 -J-Duser.language=en -J-Duser.country=SK -J-Dfile.encoding=UTF-8 --features=io.quarkus.runner.Feature,io.quarkus.runtime.graal.DisableLoggingFeature -J--add-exports=java.security.jgss/sun.security.krb5=ALL-UNNAMED -J--add-opens=java.base/java.text=ALL-UNNAMED -J--add-opens=java.base/java.io=ALL-UNNAMED -J--add-opens=java.base/java.lang.invoke=ALL-UNNAMED -J--add-opens=java.base/java.util=ALL-UNNAMED -H:BuildOutputJSONFile=code-with-quarkus-1.0.0-SNAPSHOT-runner-build-output-stats.json -H:+AllowFoldMethods -J-Djava.awt.headless=true --no-fallback --link-at-build-time -H:+ReportExceptionStackTraces -H:-AddAllCharsets --enable-url-protocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace -J--add-exports=org.graalvm.sdk/org.graalvm.nativeimage.impl=ALL-UNNAMED --exclude-config io\.netty\.netty-codec /META-INF/native-image/io\.netty/netty-codec/generated/handlers/reflect-config\.json --exclude-config io\.netty\.netty-handler /META-INF/native-image/io\.netty/netty-handler/generated/handlers/reflect-config\.json code-with-quarkus-1.0.0-SNAPSHOT-runner -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
========================================================================================================================
GraalVM Native Image: Generating 'code-with-quarkus-1.0.0-SNAPSHOT-runner' (executable)...
========================================================================================================================
For detailed information and explanations on the build output, visit:
https://github.com/oracle/graal/blob/master/docs/reference-manual/native-image/BuildOutput.md
------------------------------------------------------------------------------------------------------------------------

[1/8] Initializing...                                                                                    (0.0s @ 0.04GB)
Error: Feature io.quarkus.runtime.graal.DisableLoggingFeature class not found on the classpath. Ensure that the name is correct and that the class is on the classpath.
com.oracle.svm.core.util.UserError$UserException: Feature io.quarkus.runtime.graal.DisableLoggingFeature class not found on the classpath. Ensure that the name is correct and that the class is on the classpath.
    at org.graalvm.nativeimage.builder/com.oracle.svm.core.util.UserError.abort(UserError.java:73)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.FeatureHandler.registerFeatures(FeatureHandler.java:176)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.setupNativeImage(NativeImageGenerator.java:877)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGenerator.doRun(NativeImageGenerator.java:579)
    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)
    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)
------------------------------------------------------------------------------------------------------------------------
                        0.3s (4.5% of total time) in 13 GCs | Peak RSS: 0.30GB | CPU load: 1.95
Fatal error: jdk.vm.ci.common.JVMCIError: java.nio.file.FileSystemException: /project/code-with-quarkus-1.0.0-SNAPSHOT-runner-build-output-stats.json: Too many open files
    at jdk.internal.vm.ci/jdk.vm.ci.common.JVMCIError.shouldNotReachHere(JVMCIError.java:52)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.reports.ReportUtils.reportImpl(ReportUtils.java:159)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.reports.ReportUtils.report(ReportUtils.java:140)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ProgressReporter.reportBuildOutput(ProgressReporter.java:726)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ProgressReporter.createAdditionalArtifacts(ProgressReporter.java:697)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.ProgressReporter.printEpilog(ProgressReporter.java:652)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.reportEpilog(NativeImageGeneratorRunner.java:474)
    at org.graalvm.nativeimage.builder/com.oracle.svm.hosted.NativeImageGeneratorRunner.buildImage(NativeImageGeneratorRunner.java:466)
    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)
Caused by: java.nio.file.FileSystemException: /project/code-with-quarkus-1.0.0-SNAPSHOT-runner-build-output-stats.json: Too many open files
    at java.base/sun.nio.fs.UnixException.translateToIOException(UnixException.java:100)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:106)
    at java.base/sun.nio.fs.UnixException.rethrowAsIOException(UnixException.java:111)
    at java.base/sun.nio.fs.UnixFileSystemProvider.newByteChannel(UnixFileSystemProvider.java:218)
    at java.base/java.nio.file.Files.newByteChannel(Files.java:380)
    at java.base/java.nio.file.Files.createFile(Files.java:658)
    at org.graalvm.nativeimage.pointsto/com.oracle.graal.pointsto.reports.ReportUtils.reportImpl(ReportUtils.java:149)
    ... 9 more
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  27.344 s
[INFO] Finished at: 2023-10-27T22:04:09+02:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:3.4.3: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: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 1
[ERROR]     at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:457)
[ERROR]     at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:263)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[ERROR]     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
[ERROR]     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
[ERROR]     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
[ERROR]     at io.quarkus.deployment.ExtensionLoader$3.execute(ExtensionLoader.java:858)
[ERROR]     at io.quarkus.builder.BuildContext.run(BuildContext.java:282)
[ERROR]     at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2513)
[ERROR]     at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1538)
[ERROR]     at java.base/java.lang.Thread.run(Thread.java:833)
[ERROR]     at org.jboss.threads.JBossThread.run(JBossThread.java:501)
[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

How to Reproduce?

Steps to reproduce:

  1. Visit https://code.quarkus.io/
  2. Select version 3.4 (and Java Version 17)
  3. Select the RESTEasy Reactive Jackson and REST Client Reactive Jackson extensions
  4. Download the project as a zip
  5. Extract the content and go to the code-with-quarkus folder
  6. Run quarkus build --native --no-tests -Dnative.container-build=true -Dquarkus.native.container-runtime=podman

Output of uname -a or ver

Darwin Patriks-MacBook-Pro.local 23.0.0 Darwin Kernel Version 23.0.0: Fri Sep 15 14:42:42 PDT 2023; root:xnu-10002.1.13~1/RELEASE_X86_64 x86_64

Output of java -version

openjdk version "17.0.6" 2023-01-17 LTS OpenJDK Runtime Environment Zulu17.40+19-CA (build 17.0.6+10-LTS) OpenJDK 64-Bit Server VM Zulu17.40+19-CA (build 17.0.6+10-LTS, mixed mode, sharing)

Mandrel or GraalVM version (if different from Java)

No response

Quarkus version or git rev

3.4.3

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

Apache Maven 3.9.5 (57804ffe001d7215b5e7bcb531cf83df38f93546) Maven home: /Users/patriktoth/.m2/wrapper/dists/apache-maven-3.9.5-bin/32db9c34/apache-maven-3.9.5 Java version: 17.0.6, vendor: Azul Systems, Inc., runtime: /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home Default locale: en_SK, platform encoding: UTF-8 OS name: "mac os x", version: "14.0", arch: "x86_64", family: "mac"

Additional information

podman version

Client:       Podman Engine
Version:      4.7.1
API Version:  4.7.1
Go Version:   go1.21.3
Git Commit:   ef83eeb9c7482826672f3efa12db3d61c88df6c4
Built:        Thu Oct  5 15:21:06 2023
OS/Arch:      darwin/amd64

Server:       Podman Engine
Version:      4.7.0
API Version:  4.7.0
Go Version:   go1.20.8
Built:        Wed Sep 27 20:24:38 2023
OS/Arch:      linux/amd64

podman machine inspect

[
     {
          "ConfigPath": {
               "Path": "/Users/patriktoth/.config/containers/podman/machine/qemu/podman-machine-default.json"
          },
          "ConnectionInfo": {
               "PodmanSocket": {
                    "Path": "/Users/patriktoth/.local/share/containers/podman/machine/qemu/podman.sock"
               },
               "PodmanPipe": null
          },
          "Created": "2023-10-26T21:52:57.393505+02:00",
          "Image": {
               "IgnitionFilePath": {
                    "Path": "/Users/patriktoth/.config/containers/podman/machine/qemu/podman-machine-default.ign"
               },
               "ImageStream": "testing",
               "ImagePath": {
                    "Path": "/Users/patriktoth/.local/share/containers/podman/machine/qemu/podman-machine-default_fedora-coreos-38.20231014.2.0-qemu.x86_64.qcow2"
               }
          },
          "LastUp": "2023-10-27T21:52:37.633828+02:00",
          "Name": "podman-machine-default",
          "Resources": {
               "CPUs": 16,
               "DiskSize": 60,
               "Memory": 8192
          },
          "SSHConfig": {
               "IdentityPath": "/Users/patriktoth/.ssh/podman-machine-default",
               "Port": 61345,
               "RemoteUsername": "core"
          },
          "State": "running",
          "UserModeNetworking": true,
          "Rootful": true
     }
]
quarkus-bot[bot] commented 1 year ago

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

zakkak commented 1 year ago

@patr1kt0th can you please try the following?

podman machine stop
ulimit -n 10240
podman machine start

and try building again?

FTR A similar issue was discussed in https://quarkusio.zulipchat.com/#narrow/stream/187038-dev/topic/.E2.9C.94.20Podman.20container.20builds.20on.20Mac.20M1.2FM2

patr1kt0th commented 1 year ago

@zakkak thanks a lot for the hint, you're a lifesaver 👍 After setting the limit I was able to successfully complete the build 🎆 Should I close the issue?