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

Quarkus 1.12.1.Final:Build failure in native mode on windows #15459

Closed
yuhaibohotmail opened this issue Mar 4, 2021 · 10 comments · Fixed by #15475
Closed

Quarkus 1.12.1.Final:Build failure in native mode on windows #15459

yuhaibohotmail opened this issue Mar 4, 2021 · 10 comments · Fixed by #15475
Assignees
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Milestone

Comments

@yuhaibohotmail
Copy link

Describe the bug
(Describe the problem clearly and concisely.)

Build failure in native mode on windows with 1.12.1.Final.
It work fine with 1.12.0.Final.

[INFO] --- quarkus-maven-plugin:1.12.1.Final:build (default) @ code-with-quarkus ---
[INFO] [org.jboss.threads] JBoss Threads version 3.2.0.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 fat jar: C:\temp\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:\temp\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 Version 21.0.0.2 (Java Version 11.0.10+8-jvmci-21.0-b06)
[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildStep] -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=zh -J-Duser.country=CN -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-UseServiceLoaderFeature -H:+StackTrace code-with-quarkus-1.0.0-SNAPSHOT-runner.exe
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]    classlist:   3,359.26 ms,  0.96 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]        (cap):   2,308.23 ms,  0.96 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]        setup:   4,709.54 ms,  0.96 GB
09:06:49,719 INFO  [org.jbo.threads] JBoss Threads version 3.2.0.Final
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]     (clinit):     594.40 ms,  2.64 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]   (typeflow):  17,621.32 ms,  2.64 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]    (objects):  13,207.32 ms,  2.64 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]   (features):     494.51 ms,  2.64 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]     analysis:  32,857.40 ms,  2.64 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]     universe:   1,654.41 ms,  2.64 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]      (parse):   5,398.31 ms,  2.64 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]     (inline):   3,204.22 ms,  3.78 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]    (compile):  29,779.77 ms,  4.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]      compile:  43,271.05 ms,  4.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]        image:   3,742.70 ms,  4.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]        write:     730.29 ms,  4.88 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner.exe:11972]      [total]:  90,685.81 ms,  4.88 GB
[INFO] ------------------------------------------------------------------------
[INFO] BUILD FAILURE
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  01:54 min
[INFO] Finished at: 2021-03-04T09:07:57+08:00
[INFO] ------------------------------------------------------------------------
[ERROR] Failed to execute goal io.quarkus:quarkus-maven-plugin:1.12.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:281)
[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:920)
[ERROR]         at io.quarkus.builder.BuildContext.run(BuildContext.java:277)
[ERROR]         at org.jboss.threads.EnhancedQueueExecutor$Task.run(EnhancedQueueExecutor.java:2415)
[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:501)
[ERROR] Caused by: java.nio.file.NoSuchFileException: C:\temp\code-with-quarkus\target\code-with-quarkus-1.0.0-SNAPSHOT-native-image-source-jar\code-with-quarkus-1.0.0-SNAPSHOT-runner.exe
[ERROR]         at java.base/sun.nio.fs.WindowsException.translateToIOException(WindowsException.java:85)
[ERROR]         at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:103)
[ERROR]         at java.base/sun.nio.fs.WindowsException.rethrowAsIOException(WindowsException.java:108)
[ERROR]         at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:53)
[ERROR]         at java.base/sun.nio.fs.WindowsFileAttributeViews$Basic.readAttributes(WindowsFileAttributeViews.java:38)
[ERROR]         at java.base/sun.nio.fs.WindowsFileSystemProvider.readAttributes(WindowsFileSystemProvider.java:198)
[ERROR]         at java.base/java.nio.file.Files.readAttributes(Files.java:1764)
[ERROR]         at java.base/java.nio.file.FileTreeWalker.getAttributes(FileTreeWalker.java:225)
[ERROR]         at java.base/java.nio.file.FileTreeWalker.visit(FileTreeWalker.java:276)
[ERROR]         at java.base/java.nio.file.FileTreeWalker.walk(FileTreeWalker.java:322)
[ERROR]         at java.base/java.nio.file.Files.walkFileTree(Files.java:2717)
[ERROR]         at io.quarkus.bootstrap.util.IoUtils.copy(IoUtils.java:126)
[ERROR]         at io.quarkus.deployment.pkg.steps.NativeImageBuildStep.build(NativeImageBuildStep.java:257)
[ERROR]         ... 10 more
[ERROR] -> [Help 1]

Expected behavior
(Describe the expected behavior clearly and concisely.)

Actual behavior
(Describe the actual behavior clearly and concisely.)

To Reproduce

Steps to reproduce the behavior:

  1. gennate a sample project with https://code.quarkus.io/
  2. mvn clean package -Pnative

Configuration

# Add your application.properties here, if applicable.

Screenshots
(If applicable, add screenshots to help explain your problem.)

Environment (please complete the following information):

  • Output of uname -a or ver: windows 10.0.19041.804
  • Output of java -version: build 11.0.7+8-LTS
  • GraalVM version (if different from Java): graalvm-ce-java11-21.0.0.2
  • Quarkus version or git rev: 1.12.1.Final
  • Build tool (ie. output of mvnw --version or gradlew --version):

Additional context
(Add any other context about the problem here.)

@yuhaibohotmail yuhaibohotmail added the kind/bug Something isn't working label Mar 4, 2021
@quarkus-bot quarkus-bot bot added the env/windows Impacts Windows machines label Mar 4, 2021
@gsmet
Copy link
Member

gsmet commented Mar 4, 2021

Is there an exe somewhere? Or there's nothing created?

@yuhaibohotmail
Copy link
Author

yuhaibohotmail commented Mar 4, 2021

Here is the generated file list:

2021/03/04  23:02        30,102,016 code-with-quarkus-1.0.0-SNAPSHOT-runner.exe.exe
2021/03/04  23:02           120,178 code-with-quarkus-1.0.0-SNAPSHOT-runner.exe.exp
2021/03/04  23:02           221,476 code-with-quarkus-1.0.0-SNAPSHOT-runner.exe.lib
2021/03/04  23:02         1,224,704 code-with-quarkus-1.0.0-SNAPSHOT-runner.exe.pdb
2021/03/04  23:02           372,736 code-with-quarkus-1.0.0-SNAPSHOT-runner.exe.stripped.pdb
2021/03/04  23:01        11,312,248 code-with-quarkus-1.0.0-SNAPSHOT-runner.jar

@gsmet
Copy link
Member

gsmet commented Mar 4, 2021

Ah ah... looks like we have a bug.

@gsmet gsmet self-assigned this Mar 4, 2021
gsmet added a commit to gsmet/quarkus that referenced this issue Mar 4, 2021
This confusion broke the native executable build on Windows in
1.12.1.Final.

Fixes quarkusio#15459
@gsmet
Copy link
Member

gsmet commented Mar 4, 2021

@yuhaibohotmail could you have a look at this PR: #15475 .

It should fix it but I don't have a Windows box to check.

https://github.com/quarkusio/quarkus/blob/master/CONTRIBUTING.md#checking-an-issue-is-fixed-in-master might be helpful except you need to build my branch instead of master.

gsmet added a commit to gsmet/quarkus that referenced this issue Mar 4, 2021
This confusion broke the native executable build on Windows in
1.12.1.Final.

Fixes quarkusio#15459
@yuhaibohotmail
Copy link
Author

I'll try, thanks!

@yuhaibohotmail
Copy link
Author

@gsmet Build failure with your branch:

[INFO] [io.quarkus.deployment.pkg.steps.NativeImageBuildRunner] C:\tools\graalvm-ce-java11-21.0.0.2\bin\native-image.cmd -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=1 -J-Duser.language=zh -J-Duser.country=CN -J-Dfile.encoding=UTF-8 --initialize-at-build-time= -H:InitialCollectionPolicy=com.oracle.svm.core.genscavenge.CollectionPolicy\$BySpaceAndTime -H:+JNI -H:+AllowFoldMethods -jar code-with-quarkus-1.0.0-SNAPSHOT-runner.jar -H:FallbackThreshold=0 -H:+ReportExceptionStackTraces -H:-AddAllCharsets -H:EnableURLProtocols=http -H:-UseServiceLoaderFeature -H:+StackTrace code-with-quarkus-1.0.0-SNAPSHOT-runner
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]    classlist:   3,289.45 ms,  0.96 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]        (cap):   2,236.32 ms,  0.96 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]        setup:   5,053.82 ms,  0.96 GB
01:40:25,129 INFO  [org.jbo.threads] JBoss Threads version 3.2.0.Final
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]     (clinit):     552.87 ms,  2.65 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]   (typeflow):  19,224.20 ms,  2.65 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]    (objects):  12,166.45 ms,  2.65 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]   (features):     448.99 ms,  2.65 GB
[code-with-quarkus-1.0.0-SNAPSHOT-runner:5852]     analysis:  33,222.24 ms,  2.65 GB
Error: No instances of java.lang.ProcessEnvironment are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.lang.ProcessEnvironment.
Detailed message:
Trace: Object was reached by
        reading field java.util.Collections$UnmodifiableMap.m of
                constant java.util.Collections$UnmodifiableMap@1288b52a reached by
        reading field java.util.Collections$UnmodifiableMap.m of
                constant java.util.Collections$UnmodifiableMap@483abe6a reached by
        reading field java.util.Collections$UnmodifiableMap.m of
                constant java.util.Collections$UnmodifiableMap@52cb693f reached by
        reading field io.smallrye.config.common.MapBackedConfigSource.properties of
                constant io.smallrye.config.EnvConfigSource@3ae0558b reached by
        indexing into array
                constant java.lang.Object[]@5cd09755 reached by
        reading field java.util.ArrayList.elementData of
                constant java.util.ArrayList@3778c5aa reached by
        reading field java.util.Collections$UnmodifiableCollection.c of
                constant java.util.Collections$UnmodifiableRandomAccessList@f6cdedf reached by
        reading field io.smallrye.config.SmallRyeConfig$ConfigSources.sources of
                constant io.smallrye.config.SmallRyeConfig$ConfigSources@412228bf reached by
        reading field java.util.concurrent.atomic.AtomicReference.value of
                constant java.util.concurrent.atomic.AtomicReference@18f506c6 reached by
        reading field io.smallrye.config.SmallRyeConfig.configSources of
                constant io.smallrye.config.SmallRyeConfig@6b143c70 reached by
        reading field io.quarkus.runtime.configuration.QuarkusConfigFactory.config

com.oracle.svm.core.util.UserError$UserException: No instances of java.lang.ProcessEnvironment are allowed in the image heap as this class should be initialized at image runtime. To see how this object got instantiated use --trace-object-instantiation=java.lang.ProcessEnvironment.
Detailed message:

@gsmet
Copy link
Member

gsmet commented Mar 4, 2021

I don't really see how this could be related to my changes.

Are you sure:

  • you use the quarkus-bom (not the quarkus-universe-bom)
  • you have updated both the quarkus-bom and the quarkus-maven-plugin to 999-SNAPSHOT?

@gsmet
Copy link
Member

gsmet commented Mar 4, 2021

Hmmm, you're right, I was able to reproduce it.

@gsmet
Copy link
Member

gsmet commented Mar 4, 2021

It's totally unrelated and is master only I think.

@gsmet
Copy link
Member

gsmet commented Mar 5, 2021

Just a note that we are making progress on this.

The ProcessEnvironment issue is specific to Windows as only on Windows it extends HashMap and is directly returned by System#getEnv(). As it is forbidden in the heap by GraalVM, we need to copy the map.

@radcortez is working on a fix in SmallRye Config.

gsmet added a commit to gsmet/quarkus that referenced this issue Mar 5, 2021
This confusion broke the native executable build on Windows in
1.12.1.Final.

Fixes quarkusio#15459
gsmet added a commit to gsmet/quarkus that referenced this issue Mar 8, 2021
This confusion broke the native executable build on Windows in
1.12.1.Final.

Fixes quarkusio#15459
@quarkus-bot quarkus-bot bot added this to the 1.13 - master milestone Mar 9, 2021
gsmet added a commit to gsmet/quarkus that referenced this issue Mar 9, 2021
This confusion broke the native executable build on Windows in
1.12.1.Final.

Fixes quarkusio#15459
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
env/windows Impacts Windows machines kind/bug Something isn't working
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants