Giter Site home page Giter Site logo

Comments (5)

selhagani avatar selhagani commented on September 12, 2024

Hi @cnico,

Thank you for sharing this with us.
I tested on my end and I confirm the issue you're facing.
We will take a look into this and I'll keep you updated

from graal.

selhagani avatar selhagani commented on September 12, 2024

Hi @cnico,

Could you please try to test while using this option -H:ThrowMissingRegistrationErrors= to your native image build command and share your findings with me?

Here's an Example Command:

native-image -H:ThrowMissingRegistrationErrors= -jar your-app.jar

from graal.

cnico avatar cnico commented on September 12, 2024

Hi @selhagani,
I have added this option to the build and I see it is correctly taken into account by the maven build logs.
The native executable is correctly generated without error.
When I start the exe, it works without error or warning on the console and I still can not attach the process in visualvm.
I added it to the github project that helps reproducing the problem in case you want to have a look at it : https://github.com/cnico/native-image-maven-demo

from graal.

selhagani avatar selhagani commented on September 12, 2024

Could you please share with me the logs now that you added that option for the newly built native image? thank you!

from graal.

cnico avatar cnico commented on September 12, 2024

The logs at build time are :

...
========================================================================================================================
GraalVM Native Image: Generating 'demo-native-image-maven' (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...                                                                                   (40,4s @ 0,18GB)
 Java version: 22.0.2+9, vendor version: GraalVM CE 22.0.2+9.1
 Graal compiler: optimization level: 2, target machine: x86-64-v3
 C compiler: cl.exe (microsoft, x64, 19.38.33135)
 Garbage collector: Serial GC (max heap size: 80% of RAM)
 1 user-specific feature(s):
 - com.oracle.svm.thirdparty.gson.GsonFeature
------------------------------------------------------------------------------------------------------------------------
 1 experimental option(s) unlocked:
 - '-H:ThrowMissingRegistrationErrors': This can happen on reflection and serialization queries, and resource access. (origin(s): command line)
------------------------------------------------------------------------------------------------------------------------
Build resources:
 - 20,88GB of memory (52,6% of 39,68GB system memory, determined at start)
 - 12 thread(s) (100,0% of 12 available processor(s), determined at start)
# Printing compilation-target information to: D:\platform_java21\workspace\native-image-maven-demo\target\reports\target_info_20240828_135049.txt
# Printing native-library information to: D:\platform_java21\workspace\native-image-maven-demo\target\reports\native_library_info_20240828_135057.txt
[2/8] Performing analysis...  [*****]                                                                    (8,0s @ 0,28GB)
    3?177 reachable types   (72,2% of    4?400 total)
    3?686 reachable fields  (42,8% of    8?615 total)
   14?815 reachable methods (44,2% of   33?534 total)
    1?058 types,    53 fields, and   545 methods registered for reflection
       61 types,    51 fields, and    52 methods registered for JNI access
        1 native library: version
[3/8] Building universe...                                                                               (1,4s @ 0,29GB)
[4/8] Parsing methods...      [*]                                                                        (0,8s @ 0,31GB)
[5/8] Inlining methods...     [***]                                                                      (0,7s @ 0,33GB)
[6/8] Compiling methods...    [***]                                                                      (8,2s @ 0,30GB)
[7/8] Laying out methods...   [*]                                                                        (1,0s @ 0,35GB)
[8/8] Creating image...       [*]                                                                        (1,3s @ 0,43GB)
   5,13MB (40,41%) for code area:     8?401 compilation units
   7,41MB (58,30%) for image heap:   90?255 objects and 75 resources
 167,95kB ( 1,29%) for other data
  12,70MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 origins of code area:                                Top 10 object types in image heap:
   3,77MB java.base                                            1,52MB byte[] for code metadata
 983,86kB svm.jar (Native Image)                               1,21MB byte[] for java.lang.String
 114,75kB java.logging                                       910,38kB java.lang.String
  65,55kB org.graalvm.nativeimage.base                       753,29kB java.lang.Class
  45,84kB jdk.proxy3                                         383,88kB heap alignment
  44,42kB jdk.proxy1                                         347,78kB byte[] for general heap data
  27,00kB jdk.internal.vm.ci                                 273,02kB com.oracle.svm.core.hub.DynamicHubCompanion
  22,68kB org.graalvm.collections                            244,31kB java.util.HashMap$Node
  11,42kB jdk.proxy2                                         196,05kB java.lang.Object[]
   8,18kB jdk.graal.compiler                                 180,16kB java.lang.String[]
   4,68kB for 3 more packages                                  1,47MB for 883 more object types
------------------------------------------------------------------------------------------------------------------------
Recommendations:
 HEAP: Set max heap for improved and more predictable memory usage.
 CPU:  Enable more CPU features with '-march=native' for improved performance.
------------------------------------------------------------------------------------------------------------------------
                        1,3s (2,0% of total time) in 176 GCs | Peak RSS: 0,82GB | CPU load: 3,40
------------------------------------------------------------------------------------------------------------------------
Build artifacts:
 D:\platform_java21\workspace\native-image-maven-demo\target\demo-native-image-maven.exe (executable)
========================================================================================================================
Finished generating 'demo-native-image-maven' in 1m 2s.
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------

And there is no log à runtime for the exe : I have just the System.out.print of my Java main :

D:\platform_java21\workspace\native-image-maven-demo>target\demo-native-image-maven.exe
Starting to compute prime numbers :)
2
3
5
7
11
13
17
19
23
29
31
37
41
43
47
...

and so on to the end of the program.

from graal.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.