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

Image generation failed. Exit code: 255 in windows 10 #25954

Closed
AndrewGB123 opened this issue Jun 3, 2022 · 13 comments · Fixed by #26357
Closed

Image generation failed. Exit code: 255 in windows 10 #25954

AndrewGB123 opened this issue Jun 3, 2022 · 13 comments · Fixed by #26357
Assignees
Labels
area/native-image env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@AndrewGB123
Copy link

AndrewGB123 commented Jun 3, 2022

Describe the bug

I can't do native build with graalvm
I'm execute ./mvnw package -Pnative
I try to compile native using jdbc and specifying the DB credentials in the properties file but I get an error, however this only happens when I add the dependencies

<dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-hibernate-orm</artifactId>
    </dependency>
    <dependency>
      <groupId>io.quarkus</groupId>
      <artifactId>quarkus-jdbc-oracle</artifactId>
    </dependency>

If I try to make the native compilation without these dependencies I can execute it without any problem

Expected behavior

Run a native executable.

Actual behavior

I'm execute ./mvnw package -Pnative and my log return this error:

C:\Users\andre\IdeaProjects\code-with-quarkus>mvnw package -Pnative
[INFO] Scanning for projects...
[INFO]
[INFO] ---------------------< com.tmve:code-with-quarkus >---------------------
[INFO] Building code-with-quarkus 1.0.0-SNAPSHOT
[INFO] --------------------------------[ jar ]---------------------------------
[INFO]
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 2 resources
[INFO]
[INFO] --- quarkus-maven-plugin:2.9.2.Final:generate-code (default) @ code-with-quarkus ---
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ code-with-quarkus ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- quarkus-maven-plugin:2.9.2.Final:generate-code-tests (default) @ code-with-quarkus ---
[INFO]
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ code-with-quarkus ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory C:\Users\andre\IdeaProjects\code-with-quarkus\src\test\resources
[INFO]
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ code-with-quarkus ---
[INFO] Nothing to compile - all classes are up to date
[INFO]
[INFO] --- maven-surefire-plugin:3.0.0-M5:test (default-test) @ code-with-quarkus ---
[INFO]
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running com.tmve.GreetingResourceTest
2022-06-03 10:15:06,888 INFO  [org.jbo.threads] (main) JBoss Threads version 3.4.2.Final
2022-06-03 10:15:07,527 WARN  [io.qua.hib.orm.dep.HibernateOrmProcessor] (build-34) Hibernate ORM is disabled because no JPA entities were found
2022-06-03 10:15:10,435 INFO  [io.quarkus] (main) code-with-quarkus 1.0.0-SNAPSHOT on JVM (powered by Quarkus 2.9.2.Final) started in 4.712s. Listening on: http://localhost:8081
2022-06-03 10:15:10,435 INFO  [io.quarkus] (main) Profile test activated.
2022-06-03 10:15:10,436 INFO  [io.quarkus] (main) Installed features: [agroal, cdi, hibernate-orm, jdbc-oracle, narayana-jta, resteasy, resteasy-jackson, smallrye-context-propagation, vertx]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 8.616 s - in com.tmve.GreetingResourceTest
2022-06-03 10:15:12,938 INFO  [io.quarkus] (main) code-with-quarkus stopped in 0.056s
[INFO]
[INFO] Results:
[INFO]
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0
[INFO]
[INFO]
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ code-with-quarkus ---
[INFO]
[INFO] --- quarkus-maven-plugin:2.9.2.Final:build (default) @ code-with-quarkus ---
[WARNING] [io.quarkus.deployment.steps.NativeImageAllowIncompleteClasspathAggregateStep] The following extensions have required native-image to allow run-time resolution of classes: {quarkus-jdbc-oracle}. This is a global requirement which might have unexpected effects on other extensions as well, and is a hint of the library needing some additional refactoring to better support GraalVM native-image. In the case of 3rd party dependencies and/or proprietary code there is not much we can do - please ask for support to your library vendor. If you incur in any problem with other Quarkus extensions, please try reproducing the problem without these extensions first.
[WARNING] [io.quarkus.hibernate.orm.deployment.HibernateOrmProcessor] Hibernate ORM is disabled because no JPA entities were found
[INFO] [org.hibernate.Version] HHH000412: Hibernate ORM core version 5.6.9.Final
[WARNING] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Uber JAR strategy is used for native image source JAR generation on Windows. This is done for the time being to work around a current GraalVM limitation on Windows concerning the maximum command length (see https://github.com/oracle/graal/issues/2387).
[INFO] [io.quarkus.deployment.pkg.steps.JarResultBuildStep] Building uber jar: C:\Users\andre\IdeaProjects\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 C:\Users\andre\IdeaProjects\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] Running Quarkus native-image plugin on GraalVM 22.0.0.2 Java 17 CE (Java Version 17.0.2+8-jvmci-22.0-b05)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] C:\Program Files (x86)\graalvm-ce-java17-22.0.0.2\bin\native-image.cmd -J-DCoordinatorEnvironmentBean.transactionStatusManagerEnable=false -J-Djava.util.logging.manager=org.jboss.logmanager.LogManager -J-Dsun.nio.ch.maxUpdateArraySize=100 -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=US -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 --allow-incomplete-classpath -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http,https -H:-UseServiceLoaderFeature -H:+StackTrace --exclude-config .*com\.oracle\.database\.jdbc.* /META-INF/native-image/(?:native-image\.properties|reflect-config\.json) code-with-quarkus-1.0.0-SNAPSHOT-runner -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar
The system cannot find the path specified.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  37.312 s
[INFO] Finished at: 2022-06-03T10:15:29-04:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus.platform:quarkus-maven-plugin:2.9.2.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: io.quarkus.deployment.pkg.steps.NativeImageBuildStep$ImageGenerationFailureException: Image generation failed. Exit code: 255[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.imageGenerationFailed(NativeImageBuildStep.java:400)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:240)
[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:925)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.ContextHandler$1.runWith(ContextHandler.java:18)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2449)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$ThreadBody.run(EnhancedQueueExecutor.java:1478)
[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?

adding the jdbc and hibernate dependencies and then running mvnw package -Pnative

Output of uname -a or ver

Windows 10

Output of java -version

java version "11.0.13" 2021-10-19 LTS Java(TM) SE Runtime Environment 18.9 (build 11.0.13+10-LTS-370) Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.13+10-LTS-370, mixed mode)

GraalVM version (if different from Java)

GraalVM Updater 22.0.0.2

Quarkus version or git rev

2.9.1.Final

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

Apache Maven 3.8.4 (9b656c72d54e5bacbed989b64718c159fe39b537) Maven home: C:\Users\andre.m2\wrapper\dists\apache-maven-3.8.4-bin\52ccbt68d252mdldqsfsn03jlf\apache-maven-3.8.4 Java version: 17.0.2, vendor: Oracle Corporation, runtime: C:\Program Files\Java\jdk-17.0.2 Default locale: en_US, platform encoding: Cp1252 OS name: "windows 10", version: "10.0", arch: "amd64", family: "windows"

Additional information

The project used is the base one created from https://code.quarkus.io/

@pjgg
Copy link
Contributor

pjgg commented Jun 22, 2022

I could reproduce this issue

Steps to reproduce (Windows machine)

  1. clone the following repository
    git clone --branch feat/oracle_native git@github.com:pjgg/quarkus-test-framework-1.git

  2. Go to the pom.xml located under this path examples/database-oracle and remove the following profile

<profile>
            <id>native</id>
            <activation>
                <property>
                    <name>native</name>
                </property>
            </activation>
        </profile>
  1. run the following command from the root project folder

mvn clean verify -Pframework,examples,native -pl examples/database-oracle

@rsvoboda
Copy link
Member

CC @zakkak / @galderz for Mandrel, @Sanne for HHH / Oracle jdbc

@zakkak
Copy link
Contributor

zakkak commented Jun 22, 2022

The build fails with:

The system cannot find the path specified.

when trying to run native-image.

@AndrewGB123 you are most probably affected by oracle/graal#4635, to check this you can try installing GraalVM in a path without spaces and rerun. Can you also please run with -Dquarkus.native.additional-build-args=--verbose?

You might wan to check if C:\Program Files (x86)\graalvm-ce-java17-22.0.0.2\bin\native-image.cmd is an actual path on your system as well?

@Sanne
Copy link
Member

Sanne commented Jun 22, 2022

The logged warning got my attention, sent PR #26289 because of it.

@rsvoboda
Copy link
Member

We have seen the failure just with "quarkus-jdbc-oracle", not with other jdbc drivers

Oracle example was merged 2 days ago - quarkus-qe/quarkus-test-framework#489
And after that we noticed the failure in Windows native daily runs (PR CI focuses on Linux)

Other DBs work fine

[INFO] Quarkus - Test Framework - Examples - Database - MySQL SUCCESS [06:42 min]
[INFO] Quarkus - Test Framework - Examples - Database - Postgresql SUCCESS [05:29 min]
[INFO] Quarkus - Test Framework - Examples - Database - Oracle FAILURE [ 25.747 s]

(from https://github.com/quarkus-qe/quarkus-test-framework/runs/6975549561?check_suite_focus=true)

@zakkak
Copy link
Contributor

zakkak commented Jun 22, 2022

@AndrewGB123 you are most probably affected by oracle/graal#4635, to check this you can try installing GraalVM in a path without spaces and rerun. Can you also please run with -Dquarkus.native.additional-build-args=--verbose?

Hmm in @pjgg's run logs though GraalVM is installed in a path without spaces, so this can't be the issue.

You might wan to check if C:\Program Files (x86)\graalvm-ce-java17-22.0.0.2\bin\native-image.cmd is an actual path on your system as well?

Similarly in @pjgg's run logs other tests are working just fine so the issue can't be related to the installation path.

Can you please reproduce the issue with -Dquarkus.native.additional-build-args=--verbose? That might give us some more info to work on.

@Sanne
Copy link
Member

Sanne commented Jun 22, 2022

since it works fine on other DBs, there might be something "special" about the Oracle specific overrides we have put in place to exclude metadata.

I see from the logs above it includes "--exclude-config .com.oracle.database.jdbc. /META-INF/native-image/(?:native-image.properties|reflect-config.json) ".

The first argument to exclude-config should be the jar file on which the exclusion needs to be applied; it reads .com.oracle.database.jdbc. - which seems odd?

I'll double-check what I see there when running on linux, but assuming that's the problem I'd need help from someone with a windows box to test any possible fix.

@zakkak
Copy link
Contributor

zakkak commented Jun 22, 2022

The first argument to exclude-config should be the jar file on which the exclusion needs to be applied; it reads .com.oracle.database.jdbc. - which seems odd?

This is due to the log not being formatted as a code block. The actual argument (as seen in pjgg's log) is:

--exclude-config .*com\.oracle\.database\.jdbc.* /META-INF/native-image/(?:native-image\.properties|reflect-config\.json)

--exclude-config "requires two arguments: a jar regular expression and a resource regular expression", I wonder if wrapping these two in quotes would solve the issue.

@Sanne
Copy link
Member

Sanne commented Jun 22, 2022

right, this is what I see locally (linux):

--exclude-config .*com\.oracle\.database\.jdbc.* /META-INF/native-image/(?:native-image\.properties|reflect-config\.json)

so that seems to match, but I guess Windows could use some quotes. Got a draft: #26293

@pjgg could you test it ? I don't have Windows at hand.

@Sanne
Copy link
Member

Sanne commented Jun 22, 2022

My draft #26293 doesn't work as quotes directly affect the regex (it makes it fail even in Linux).

@Sanne
Copy link
Member

Sanne commented Jun 22, 2022

The logged warning got my attention, sent PR #26289 because of it.

Actually this other PR might (unintentionally) fix this ?!

If we're packaging the application as an uber-jar, no wonder that the regex doesn't match an actual jar. Too bad I'm only able to guess here - someone with Windows should confirm. cc/ @Karm

@Sanne
Copy link
Member

Sanne commented Jun 22, 2022

I'm starting to think that --exclude-config has nothing to do with this failure: I just tested that when the regex fails to match any jar, it doesn't produce an error like "The system cannot find the path specified" - in fact it doesn't produce any error at all, which makes sense since it's a regex: it might match from zero to multiple elements.

However it's true that we need #26289 for the Oracle driver to work correctly in Windows, as otherwise with uber jars the exclusions aren't applied.

@Sanne
Copy link
Member

Sanne commented Jun 24, 2022

I think I figured out what's going on; this should probably be fixed better in GraalVM, but we can already apply a simple workaround: #26357

@quarkus-bot quarkus-bot bot added this to the 2.11 - main milestone Jun 27, 2022
@Karm Karm assigned Sanne and unassigned Karm Jun 28, 2022
@gsmet gsmet modified the milestones: 2.11 - main, 2.10.1.Final Jun 28, 2022
@gsmet gsmet removed this from the 2.10.1.Final milestone Jan 13, 2023
@gsmet gsmet added this to the 2.7.7.Final milestone Jan 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment