Karm / mandrel-integration-tests

Integration tests for GraalVM and its Mandrel distribution. Runs Quarkus, Helidon and Micronaut applications and small targeted reproducers. The focus is solely on native-image utility and compilation of Java applications into native executables.
Apache License 2.0
5 stars 3 forks source link

imageioAWT integration test fails with latest 23.0.0-dev (libmanagement_ext.a no longer there) #117

Closed jerboaa closed 1 year ago

jerboaa commented 1 year ago

As of late it's failing with:

Error:  Failures: 
Error:    AppReproducersTest.imageioAWTTest:427->imageioAWT:550 A different set of static libraries was expected. 
Expected: [libawt.a, libawt_headless.a, libfdlibm.a, libfontmanager.a, libjava.a, libjavajpeg.a, libjvm.a, liblcms.a, liblibchelper.a, libmanagement_ext.a, libnet.a, libnio.a, libzip.a]
Actual:   [libawt.a, libawt_headless.a, libfdlibm.a, libfontmanager.a, libjava.a, libjavajpeg.a, libjvm.a, liblcms.a, liblibchelper.a, libnet.a, libnio.a, libzip.a] ==> expected: <true> but was:

See https://github.com/graalvm/mandrel/actions/runs/3148587052/jobs/5119491334

Related #109

jerboaa commented 1 year ago

I'll have a look later today in order to figure out what's changed in master that it's gone now again.

zakkak commented 1 year ago

Note, master is now 23.0.0-dev, 22.3 has been forked to https://github.com/oracle/graal/tree/release/graal-vm/22.3, I updated the title accordingly.

jerboaa commented 1 year ago

Note, master is now 23.0.0-dev, 22.3 has been forked to https://github.com/oracle/graal/tree/release/graal-vm/22.3, I updated the title accordingly.

OK thanks. So it might be that we have to distinguish between 22.3 and 23.0 as well for this.

jerboaa commented 1 year ago

So far, I'm not able to reproduce on F36 with latest master (revision 59c0c26add86221fa9e6af577891eb9d9d118c4f):

[INFO] Scanning for projects...
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Build Order:
[INFO] 
[INFO] Native image integration TS                                        [pom]
[INFO] testsuite                                                          [jar]
[INFO] 
[INFO] ----------------< org.graalvm.tests.integration:parent >----------------
[INFO] Building Native image integration TS 1.0.0-SNAPSHOT                [1/2]
[INFO] --------------------------------[ pom ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ parent ---
[INFO] 
[INFO] --------------< org.graalvm.tests.integration:testsuite >---------------
[INFO] Building testsuite 1.0.0-SNAPSHOT                                  [2/2]
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ testsuite ---
[INFO] Deleting /disk/graal/upstream-sources/mandrel-integration-tests/testsuite/target
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ testsuite ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 1 resource
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:compile (default-compile) @ testsuite ---
[INFO] No sources to compile
[INFO] 
[INFO] --- build-helper-maven-plugin:3.0.0:add-test-source (add-integration-test-source-as-test-sources) @ testsuite ---
[INFO] Test Source directory: /disk/graal/upstream-sources/mandrel-integration-tests/testsuite/src/it/java added.
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ testsuite ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /disk/graal/upstream-sources/mandrel-integration-tests/testsuite/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.8.1:testCompile (default-testCompile) @ testsuite ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 23 source files to /disk/graal/upstream-sources/mandrel-integration-tests/testsuite/target/test-classes
[INFO] 
[INFO] --- maven-surefire-plugin:2.22.2:test (default-test) @ testsuite ---
[INFO] 
[INFO] -------------------------------------------------------
[INFO]  T E S T S
[INFO] -------------------------------------------------------
[INFO] Running org.graalvm.tests.integration.AppReproducersTest
2022-09-29 14:41:59.924 INFO  [o.g.t.i.u.Commands] (getProperty) Failed to detect any of QUARKUS_NATIVE_CONTAINER_RUNTIME,quarkus.native.container-runtime as env or sys props, defaulting to docker
2022-09-29 14:41:59.929 INFO  [o.g.t.i.u.Commands] (getProperty) Failed to detect any of QUARKUS_NATIVE_BUILDER_IMAGE,quarkus.native.builder-image as env or sys props, defaulting to quay.io/quarkus/ubi-quarkus-mandrel:21.3-java11
2022-09-29 14:41:59.930 INFO  [o.g.t.i.u.Commands] (getProperty) Failed to detect any of PODMAN_WITH_SUDO,podman.with.sudo as env or sys props, defaulting to true
2022-09-29 14:41:59.932 INFO  [o.g.t.i.u.Commands] (getProperty) Failed to detect any of FAIL_ON_PERF_REGRESSION,fail.on.perf.regression as env or sys props, defaulting to true
2022-09-29 14:41:59.940 INFO  [o.g.t.i.u.v.UsedVersion$MVersion] (<init>) Running command [native-image, --version] to determine Mandrel version used.
2022-09-29 14:42:00.769 INFO  [o.g.t.i.u.v.UsedVersion$MVersion] (<init>) The test suite runs with Mandrel version 23.0.0-dev  installed locally on PATH, JDK 17.0.5.
2022-09-29 14:42:00.811 INFO  [o.g.t.i.AppReproducersTest] (imageioAWT) Testing app: IMAGEIO
Command: mvn clean package

[INFO] Scanning for projects...
[INFO] 
[INFO] --------------------------< imageio:imageio >---------------------------
[INFO] Building imageio 1
[INFO] --------------------------------[ jar ]---------------------------------
[INFO] 
[INFO] --- maven-clean-plugin:2.5:clean (default-clean) @ imageio ---
[INFO] 
[INFO] --- maven-resources-plugin:2.6:resources (default-resources) @ imageio ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] Copying 4 resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:compile (default-compile) @ imageio ---
[INFO] Changes detected - recompiling the module!
[INFO] Compiling 1 source file to /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/target/classes
[INFO] 
[INFO] --- maven-resources-plugin:2.6:testResources (default-testResources) @ imageio ---
[INFO] Using 'UTF-8' encoding to copy filtered resources.
[INFO] skip non existing resourceDirectory /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/src/test/resources
[INFO] 
[INFO] --- maven-compiler-plugin:3.1:testCompile (default-testCompile) @ imageio ---
[INFO] No sources to compile
[INFO] 
[INFO] --- maven-surefire-plugin:2.12.4:test (default-test) @ imageio ---
[INFO] No tests to run.
[INFO] 
[INFO] --- maven-jar-plugin:2.4:jar (default-jar) @ imageio ---
[INFO] Building jar: /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/target/imageio.jar
[INFO] 
[INFO] --- maven-shade-plugin:2.4.3:shade (default) @ imageio ---
[INFO] Including org.jfree:org.jfree.svg:jar:4.1 in the shaded jar.
[INFO] Including org.jfree:jfreechart:jar:1.5.2 in the shaded jar.
[INFO] Replacing original artifact with shaded artifact.
[INFO] Replacing /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/target/imageio.jar with /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/target/imageio-1-shaded.jar
[INFO] Dependency-reduced POM written at: /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/dependency-reduced-pom.xml
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  3.020 s
[INFO] Finished at: 2022-09-29T14:42:05+02:00
[INFO] ------------------------------------------------------------------------
Command: java -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar target/imageio.jar

Command: jar uf target/imageio.jar -C src/main/resources/ META-INF

Command: native-image -H:IncludeResources=Grace_M._Hopper.jp2,MyFreeMono.ttf,MyFreeSerif.ttf --no-fallback -jar target/imageio.jar target/imageio

========================================================================================================================
GraalVM Native Image: Generating 'target/imageio' (executable)...
========================================================================================================================
Warning: Could not resolve com.orsoncharts.Chart3DHints for reflection configuration. Reason: java.lang.ClassNotFoundException: com.orsoncharts.Chart3DHints.
[1/7] Initializing...                                                                                    (7.5s @ 0.10GB)
 Version info: 'GraalVM 23.0.0-dev Java 17 Mandrel Distribution'
 Java version info: '17.0.5-beta+5-202209062307'
 C compiler: gcc (redhat, x86_64, 12.2.1)
 Garbage collector: Serial GC
[2/7] Performing analysis...  [******]                                                                  (37.1s @ 2.38GB)
   4,850 (78.06%) of  6,213 classes reachable
   8,188 (59.32%) of 13,804 fields reachable
  22,803 (49.45%) of 46,113 methods reachable
     179 classes,     6 fields, and   603 methods registered for reflection
     139 classes,   222 fields, and   128 methods registered for JNI access
       7 native libraries: dl, freetype, m, pthread, rt, stdc++, z
[3/7] Building universe...                                                                               (7.3s @ 1.00GB)
[4/7] Parsing methods...      [**]                                                                       (4.6s @ 2.51GB)
[5/7] Inlining methods...     [***]                                                                      (3.0s @ 0.92GB)
[6/7] Compiling methods...    [******]                                                                  (33.5s @ 2.16GB)
[7/7] Creating image...                                                                                  (4.7s @ 2.99GB)
  10.12MB (40.05%) for code area:    14,086 compilation units
  12.66MB (50.12%) for image heap:  153,081 objects and 13 resources
   2.48MB ( 9.83%) for other data
  25.27MB in total
------------------------------------------------------------------------------------------------------------------------
Top 10 packages in code area:                               Top 10 object types in image heap:
 781.00KB java.util                                            2.12MB byte[] for code metadata
 697.38KB sun.font                                             1.48MB java.lang.String
 448.67KB com.sun.imageio.plugins.tiff                         1.41MB byte[] for embedded resources
 407.37KB com.sun.crypto.provider                              1.20MB byte[] for general heap data
 368.01KB java.lang                                            1.10MB java.lang.Class
 361.00KB java.awt.image                                     970.48KB byte[] for java.lang.String
 313.99KB com.sun.imageio.plugins.jpeg                       483.42KB java.util.HashMap$Node
 292.97KB sun.java2d.marlin                                  416.80KB com.oracle.svm.core.hub.DynamicHubCompanion
 279.62KB java.text                                          270.88KB java.lang.String[]
 271.42KB com.sun.imageio.plugins.png                        266.39KB java.util.concurrent.ConcurrentHashMap$Node
   5.89MB for 186 more packages                                2.34MB for 1008 more object types
------------------------------------------------------------------------------------------------------------------------
                        1.6s (1.5% of total time) in 21 GCs | Peak RSS: 5.39GB | CPU load: 5.04
------------------------------------------------------------------------------------------------------------------------
Produced artifacts:
 /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/target/imageio (executable)
 /disk/graal/upstream-sources/mandrel-integration-tests/apps/imageio/target/imageio.build_artifacts.txt (txt)
========================================================================================================================
Finished generating 'target/imageio' in 1m 42s.
2022-09-29 14:43:54.147 INFO  [o.g.t.i.AppReproducersTest] (imageioAWT) Running...
2022-09-29 14:43:57.365 INFO  [o.g.t.i.u.Logs] (checkLog) build-and-run.log log for imageioAWTTest contains whitelisted error: `Warning: Could not resolve com.orsoncharts.Chart3DHints for reflection configuration. Reason: java.lang.ClassNotFoundException: com.orsoncharts.Chart3DHints.'
[INFO] Tests run: 1, Failures: 0, Errors: 0, Skipped: 0, Time elapsed: 118.003 s - in org.graalvm.tests.integration.AppReproducersTest
[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) @ testsuite ---
[INFO] Building jar: /disk/graal/upstream-sources/mandrel-integration-tests/testsuite/target/testsuite-1.0.0-SNAPSHOT.jar
[INFO] 
[INFO] --- maven-failsafe-plugin:2.22.2:integration-test (default) @ testsuite ---
[INFO] 
[INFO] --- maven-failsafe-plugin:2.22.2:verify (default) @ testsuite ---
[INFO] ------------------------------------------------------------------------
[INFO] Reactor Summary for Native image integration TS 1.0.0-SNAPSHOT:
[INFO] 
[INFO] Native image integration TS ........................ SUCCESS [  0.189 s]
[INFO] testsuite .......................................... SUCCESS [02:04 min]
[INFO] ------------------------------------------------------------------------
[INFO] BUILD SUCCESS
[INFO] ------------------------------------------------------------------------
[INFO] Total time:  02:04 min
[INFO] Finished at: 2022-09-29T14:43:58+02:00
[INFO] ------------------------------------------------------------------------

Also, manual checking shows libmanagement_ext.a being part of the image:

$ strings target/imageio | grep com.oracle.svm.core.VM.Target.StaticLibraries
com.oracle.svm.core.VM.Target.StaticLibraries=libnet.a|libjavajpeg.a|libnio.a|libmanagement_ext.a|liblibchelper.a|libjava.a|liblcms.a|libfontmanager.a|libawt_headless.a|libawt.a|libfdlibm.a|libzip.a|libjvm.a
jerboaa commented 1 year ago

This doesn't seem deterministic?

One run from https://github.com/graalvm/mandrel/actions/runs/3140760029/jobs/5102715980:

2022-09-28T06:13:07.3792360Z ========================================================================================================================
2022-09-28T06:13:07.3800679Z GraalVM Native Image: Generating 'target/imageio' (executable)...
2022-09-28T06:13:07.3801926Z ========================================================================================================================
2022-09-28T06:13:09.2820606Z Warning: Could not resolve com.orsoncharts.Chart3DHints for reflection configuration. Reason: java.lang.ClassNotFoundException: com.orsoncharts.Chart3DHints.
2022-09-28T06:13:10.6534221Z [1/7] Initializing...                                                                                    (6.1s @ 0.21GB)
2022-09-28T06:13:10.6538311Z  Version info: 'GraalVM 23.0.0-dev Java 17 CE'
2022-09-28T06:13:10.6541348Z  Java version info: '17.0.5+3-jvmci-22.3-b04'
2022-09-28T06:13:10.6548228Z  C compiler: gcc (linux, x86_64, 9.4.0)
2022-09-28T06:13:10.6549932Z  Garbage collector: Serial GC
2022-09-28T06:13:49.3124760Z [2/7] Performing analysis...  [******]                                                                  (38.4s @ 1.69GB)
2022-09-28T06:13:49.3163637Z    4,845 (78.09%) of  6,204 classes reachable
2022-09-28T06:13:49.3201174Z    8,176 (59.48%) of 13,745 fields reachable
2022-09-28T06:13:49.3402596Z   22,788 (49.61%) of 45,930 methods reachable
2022-09-28T06:13:49.3407932Z      179 classes,     6 fields, and   603 methods registered for reflection
2022-09-28T06:13:49.3413066Z      134 classes,   217 fields, and   119 methods registered for JNI access
2022-09-28T06:13:49.3420413Z        7 native libraries: dl, freetype, m, pthread, rt, stdc++, z
2022-09-28T06:13:54.3870904Z [3/7] Building universe...                                                                               (5.0s @ 1.10GB)
2022-09-28T06:13:58.9907957Z [4/7] Parsing methods...      [**]                                                                       (4.5s @ 0.92GB)
2022-09-28T06:14:01.6920062Z [5/7] Inlining methods...     [***]                                                                      (2.5s @ 1.71GB)
2022-09-28T06:14:35.5145106Z [6/7] Compiling methods...    [******]                                                                  (33.8s @ 1.25GB)
2022-09-28T06:14:40.0088767Z [7/7] Creating image...                                                                                  (2.5s @ 1.94GB)
2022-09-28T06:14:40.0097775Z   10.11MB (39.33%) for code area:    14,071 compilation units
2022-09-28T06:14:40.0103997Z   12.66MB (49.25%) for image heap:  152,370 objects and 13 resources
2022-09-28T06:14:40.0114611Z    2.94MB (11.42%) for other data
2022-09-28T06:14:40.0119166Z   25.70MB in total
2022-09-28T06:14:40.0123760Z ------------------------------------------------------------------------------------------------------------------------
2022-09-28T06:14:40.0134751Z Top 10 packages in code area:                               Top 10 object types in image heap:
2022-09-28T06:14:40.0162476Z  781.04KB java.util                                            2.12MB byte[] for code metadata
2022-09-28T06:14:40.0167907Z  697.39KB sun.font                                             1.47MB java.lang.String
2022-09-28T06:14:40.0173750Z  448.67KB com.sun.imageio.plugins.tiff                         1.41MB byte[] for embedded resources
2022-09-28T06:14:40.0179139Z  407.40KB com.sun.crypto.provider                              1.20MB byte[] for general heap data
2022-09-28T06:14:40.0189473Z  367.46KB java.lang                                            1.10MB java.lang.Class
2022-09-28T06:14:40.0194852Z  361.00KB java.awt.image                                     969.75KB byte[] for java.lang.String
2022-09-28T06:14:40.0200171Z  313.99KB com.sun.imageio.plugins.jpeg                       499.92KB java.util.HashMap$Node
2022-09-28T06:14:40.0205548Z  292.98KB sun.java2d.marlin                                  416.37KB com.oracle.svm.core.hub.DynamicHubCompanion
2022-09-28T06:14:40.0226641Z  279.65KB java.text                                          273.43KB java.lang.String[]
2022-09-28T06:14:40.0232410Z  271.42KB com.sun.imageio.plugins.png                        266.20KB java.util.concurrent.ConcurrentHashMap$Node
2022-09-28T06:14:40.0258248Z    5.88MB for 184 more packages                                2.33MB for 1005 more object types
2022-09-28T06:14:40.0318538Z ------------------------------------------------------------------------------------------------------------------------
2022-09-28T06:14:40.0339659Z                         2.1s (2.2% of total time) in 25 GCs | Peak RSS: 2.73GB | CPU load: 1.96
2022-09-28T06:14:40.0348631Z ------------------------------------------------------------------------------------------------------------------------
2022-09-28T06:14:40.0353148Z Produced artifacts:
2022-09-28T06:14:40.0406245Z  /home/runner/work/mandrel/mandrel/mandrel-integration-tests/apps/imageio/target/imageio (executable)
2022-09-28T06:14:40.0417745Z  /home/runner/work/mandrel/mandrel/mandrel-integration-tests/apps/imageio/target/imageio.build_artifacts.txt (txt)
2022-09-28T06:14:40.0421860Z ========================================================================================================================
2022-09-28T06:14:40.0429249Z Finished generating 'target/imageio' in 1m 35s.
2022-09-28T06:14:40.2157615Z 2022-09-28 06:14:40.215 INFO  [o.g.t.i.AppReproducersTest] (imageioAWT) Running...
2022-09-28T06:14:42.9575355Z [ERROR] Tests run: 10, Failures: 2, Errors: 0, Skipped: 3, Time elapsed: 529.469 s <<< FAILURE! - in org.graalvm.tests.integration.AppReproducersTest
2022-09-28T06:14:42.9579054Z [ERROR] resLocationsC{TestInfo}  Time elapsed: 62.761 s  <<< FAILURE!
2022-09-28T06:14:42.9631907Z org.opentest4j.AssertionFailedError: 
2022-09-28T06:14:42.9632473Z Something changed in how the resources are handled. Check comments on https://github.com/oracle/graal/issues/4326 and https://github.com/quarkusio/quarkus/pull/22403. See discrepancies: 
2022-09-28T06:14:42.9632917Z Expected: 3:  N/A, Actual: 3:  JDK
2022-09-28T06:14:42.9633168Z Expected: 14: N/A, Actual: 14: JDK
2022-09-28T06:14:42.9633400Z  ==> expected: <true> but was: <false>
2022-09-28T06:14:42.9633835Z    at org.graalvm.tests.integration.AppReproducersTest.resLocations(AppReproducersTest.java:339)
2022-09-28T06:14:42.9634432Z    at org.graalvm.tests.integration.AppReproducersTest.resLocationsC(AppReproducersTest.java:304)
2022-09-28T06:14:42.9634758Z 
2022-09-28T06:14:42.9634920Z [ERROR] imageioAWTTest{TestInfo}  Time elapsed: 107.302 s  <<< FAILURE!
2022-09-28T06:14:42.9635244Z org.opentest4j.AssertionFailedError: 
2022-09-28T06:14:42.9635557Z A different set of static libraries was expected. 
2022-09-28T06:14:42.9636041Z Expected: [libawt.a, libawt_headless.a, libfdlibm.a, libfontmanager.a, libjava.a, libjavajpeg.a, libjvm.a, liblcms.a, liblibchelper.a, libmanagement_ext.a, libnet.a, libnio.a, libzip.a]
2022-09-28T06:14:42.9636699Z Actual:   [libawt.a, libawt_headless.a, libfdlibm.a, libfontmanager.a, libjava.a, libjavajpeg.a, libjvm.a, liblcms.a, liblibchelper.a, libnet.a, libnio.a, libzip.a] ==> expected: <true> but was: <false>

FAIL.

Then compare to this one from https://github.com/graalvm/mandrel/actions/runs/3148587052/jobs/5119511668

2022-09-29T06:15:29.2464527Z ========================================================================================================================
2022-09-29T06:15:29.2474488Z GraalVM Native Image: Generating 'target/imageio' (executable)...
2022-09-29T06:15:29.2474855Z ========================================================================================================================
2022-09-29T06:15:31.2676054Z Warning: Could not resolve com.orsoncharts.Chart3DHints for reflection configuration. Reason: java.lang.ClassNotFoundException: com.orsoncharts.Chart3DHints.
2022-09-29T06:15:32.7237996Z [1/7] Initializing...                                                                                    (6.3s @ 0.21GB)
2022-09-29T06:15:32.7248769Z  Version info: 'GraalVM 23.0.0-dev Java 17 CE'
2022-09-29T06:15:32.7250776Z  Java version info: '17.0.5+3-jvmci-22.3-b04'
2022-09-29T06:15:32.7258970Z  C compiler: gcc (linux, x86_64, 9.4.0)
2022-09-29T06:15:32.7260137Z  Garbage collector: Serial GC
2022-09-29T06:16:12.8472103Z [2/7] Performing analysis...  [******]                                                                  (39.8s @ 1.65GB)
2022-09-29T06:16:12.8515387Z    4,845 (78.11%) of  6,203 classes reachable
2022-09-29T06:16:12.8567119Z    8,176 (59.48%) of 13,745 fields reachable
2022-09-29T06:16:12.8775528Z   22,788 (49.61%) of 45,935 methods reachable
2022-09-29T06:16:12.8781841Z      179 classes,     6 fields, and   603 methods registered for reflection
2022-09-29T06:16:12.8786853Z      134 classes,   217 fields, and   119 methods registered for JNI access
2022-09-29T06:16:12.8792228Z        7 native libraries: dl, freetype, m, pthread, rt, stdc++, z
2022-09-29T06:16:18.1041361Z [3/7] Building universe...                                                                               (5.2s @ 1.06GB)
2022-09-29T06:16:22.9586946Z [4/7] Parsing methods...      [**]                                                                       (4.8s @ 0.91GB)
2022-09-29T06:16:25.8947457Z [5/7] Inlining methods...     [***]                                                                      (2.8s @ 1.68GB)
2022-09-29T06:17:03.6325962Z [6/7] Compiling methods...    [******]                                                                  (37.7s @ 1.32GB)
2022-09-29T06:17:08.6878154Z [7/7] Creating image...                                                                                  (2.8s @ 2.02GB)
2022-09-29T06:17:08.6889607Z   10.11MB (39.32%) for code area:    14,070 compilation units
2022-09-29T06:17:08.6895727Z   12.66MB (49.25%) for image heap:  152,410 objects and 13 resources
2022-09-29T06:17:08.6908459Z    2.94MB (11.42%) for other data
2022-09-29T06:17:08.6913260Z   25.70MB in total
2022-09-29T06:17:08.6917837Z ------------------------------------------------------------------------------------------------------------------------
2022-09-29T06:17:08.6928526Z Top 10 packages in code area:                               Top 10 object types in image heap:
2022-09-29T06:17:08.6950987Z  780.95KB java.util                                            2.12MB byte[] for code metadata
2022-09-29T06:17:08.6956684Z  697.38KB sun.font                                             1.47MB java.lang.String
2022-09-29T06:17:08.6962122Z  448.67KB com.sun.imageio.plugins.tiff                         1.41MB byte[] for embedded resources
2022-09-29T06:17:08.6967477Z  407.37KB com.sun.crypto.provider                              1.20MB byte[] for general heap data
2022-09-29T06:17:08.6972969Z  367.82KB java.lang                                            1.10MB java.lang.Class
2022-09-29T06:17:08.6978705Z  361.00KB java.awt.image                                     969.78KB byte[] for java.lang.String
2022-09-29T06:17:08.6984040Z  314.27KB com.sun.imageio.plugins.jpeg                       500.39KB java.util.HashMap$Node
2022-09-29T06:17:08.6989431Z  292.98KB sun.java2d.marlin                                  416.37KB com.oracle.svm.core.hub.DynamicHubCompanion
2022-09-29T06:17:08.6994910Z  279.62KB java.text                                          273.43KB java.lang.String[]
2022-09-29T06:17:08.7058459Z  271.42KB com.sun.imageio.plugins.png                        266.30KB java.util.concurrent.ConcurrentHashMap$Node
2022-09-29T06:17:08.7214534Z    5.88MB for 184 more packages                                2.33MB for 1005 more object types
2022-09-29T06:17:08.7255766Z ------------------------------------------------------------------------------------------------------------------------
2022-09-29T06:17:08.7274534Z                         2.2s (2.1% of total time) in 25 GCs | Peak RSS: 2.74GB | CPU load: 1.96
2022-09-29T06:17:08.7280044Z ------------------------------------------------------------------------------------------------------------------------
2022-09-29T06:17:08.7284948Z Produced artifacts:
2022-09-29T06:17:08.7417618Z  /home/runner/work/mandrel/mandrel/mandrel-integration-tests/apps/imageio/target/imageio (executable)
2022-09-29T06:17:08.7424257Z  /home/runner/work/mandrel/mandrel/mandrel-integration-tests/apps/imageio/target/imageio.build_artifacts.txt (txt)
2022-09-29T06:17:08.7428664Z ========================================================================================================================
2022-09-29T06:17:08.7434639Z Finished generating 'target/imageio' in 1m 42s.
2022-09-29T06:17:08.9166943Z 2022-09-29 06:17:08.915 INFO  [o.g.t.i.AppReproducersTest] (imageioAWT) Running...
2022-09-29T06:17:11.5857826Z 2022-09-29 06:17:11.584 INFO  [o.g.t.i.u.Logs] (checkLog) build-and-run.log log for imageioAWTTest contains whitelisted error: `Warning: Could not resolve com.orsoncharts.Chart3DHints for reflection configuration. Reason: java.lang.ClassNotFoundException: com.orsoncharts.Chart3DHints.'
2022-09-29T06:17:11.6318382Z [WARNING] Tests run: 11, Failures: 0, Errors: 0, Skipped: 4, Time elapsed: 554.57 s - in org.graalvm.tests.integration.AppReproducersTest

PASS.

Not sure what's going on...

jerboaa commented 1 year ago

I believe the analysis in https://github.com/Karm/mandrel-integration-tests/issues/109 was incorrect and this is an upstream issue. I'll get an issue filed there.

The only difference I can make out is that iff libawt_headless ends up in the image, libmanagement_extwill always end up getting linked in as well. So why would it fail for some CI systems and not for others? I can only speculate, but I'm pretty sure it's related to whether or not the JDK thinks of the system as a headless system or not. Since the integration test doesn't specify -Djava.awt.headless=false so as to always force a headless image, it's at the mercy of the JDKs/Graals heuristics to detect headless or not. The primary code being used to detect this is GraphicsEnvironment.isHeadless(). So consider a headful system (DISPLAY env defined and is indeed headful), it's conceivable that this test gets built with full awt (libxawt over libawt_headless). In that case, no libmanagement_ext would get pulled in because of this code in the afterAnalysis() method of the JNIRegistrationManagementExt automatic feature:

    @Override
    public void afterAnalysis(AfterAnalysisAccess access) {
        if (NativeLibrarySupport.singleton().isPreregisteredBuiltinLibrary("awt_headless")) {
            /*
             * Ensure that `management_ext` comes before `awt_headless` on the linker command line.
             * This is necessary to prevent linker errors such as JDK-8264047.
             */
            nativeLibraries.addStaticNonJniLibrary("management_ext", "awt_headless");
        }
    }

I cannot prove that the systems where the test is passing are indeed headful builds, but I've tried a local build with -Djava.awt.headless=false (force headful), and the link fails due to multiple jvm instances in object files (related to JDK-8264047 and friends). What I did see, though, was that libmanagement.a was no longer part of the attempted link command. That yields me to believe that on the systems where we see succeeding tests, we have GCC 9 which might suggest that the link passes there for that reason (link failure only surfaces on GCC 10+ systems). It's a theory.

Either way, what I can prove is that linkManagementExt is never being called on my system, where I do get libmanagement_ext added (I've debugged the image generation). To corroborate that, I've done a mandrel build without the unconditional inclusion of libmanagement_ext and voila, libmanagement_ext.a is gone in the generated native image. Conversely, if I add code to use the OperatingSystemMXBean in the imageio app, libmanagement_ext.a does get added as it should be. What a strange thing.

TLDR; We should specify -Djava.awt.headless=true explicitly for this test to get some more deterministic results and not be at the mercy of the system being headless or not.

jerboaa commented 1 year ago

Upstream issue is: https://github.com/oracle/graal/issues/5119