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

imageioAWTTest fails with Mandrel 22.3.0-dev #109

Closed jerboaa closed 1 year ago

jerboaa commented 1 year ago

Fails with:

org.opentest4j.AssertionFailedError: 
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, 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, libmanagement_ext.a, libnet.a, libnio.a, libzip.a] ==> expected: <true> but was: <false>
    at org.graalvm.tests.integration.AppReproducersTest.imageioAWT(AppReproducersTest.java:481)
    at org.graalvm.tests.integration.AppReproducersTest.imageioAWTTest(AppReproducersTest.java:362)
jerboaa commented 1 year ago

Caused by https://github.com/oracle/graal/pull/4383/files#diff-a8a74dc181914e085bdda2e1ea7b10ba8c3ec253b8e9b23d35dcf6730966d49bR64

Apparently the com.sun.management.internal.OperatingSystemImpl is reachable for this app.

jerboaa commented 1 year ago

Related #100

zakkak commented 1 year ago

@jerboaa I can't reproduce this with Mandrel builds using graal/master and JDK 17.0.5+5 and I also don't see it in GHA.

What's your configuration?

jerboaa commented 1 year ago

@zakkak Thanks for checking. I'll investigate...

jerboaa commented 1 year ago

I can reproduce this on my Fedora 36 machine with a graal/master build and JDK 17.0.5+5 as well as with an older build I have which was older graal master revision and JDK 17.0.4.1:

$ strings imageio-jdk-17.0.4.1 | 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
$ strings imageio-jdk-17.0.5+5 | 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

Running the test suite once more...

jerboaa commented 1 year ago

The suite produces this:

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...                                                                                    (4.4s @ 0.11GB)
 Version info: 'GraalVM 22.3.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...  [******]                                                                  (26.9s @ 2.34GB)
   4,848 (78.00%) of  6,215 classes reachable
   8,189 (59.32%) of 13,805 fields reachable
  22,802 (49.47%) of 46,096 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...                                                                               (3.8s @ 0.97GB)
[4/7] Parsing methods...      [**]                                                                       (3.7s @ 2.49GB)
[5/7] Inlining methods...     [***]                                                                      (1.8s @ 0.89GB)
[6/7] Compiling methods...    [*****]                                                                   (25.1s @ 2.04GB)
[7/7] Creating image...                                                                                  (3.0s @ 2.88GB)
  10.12MB (40.05%) for code area:    14,085 compilation units
  12.66MB (50.12%) for image heap:  153,054 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
 367.69KB java.lang                                            1.10MB java.lang.Class
 361.00KB java.awt.image                                     970.28KB byte[] for java.lang.String
 314.27KB com.sun.imageio.plugins.jpeg                       484.69KB java.util.HashMap$Node
 292.97KB sun.java2d.marlin                                  416.63KB com.oracle.svm.core.hub.DynamicHubCompanion
 279.62KB java.text                                          270.88KB java.lang.String[]
 271.42KB com.sun.imageio.plugins.png                        266.48KB java.util.concurrent.ConcurrentHashMap$Node
   5.89MB for 186 more packages                                2.35MB for 1008 more object types
------------------------------------------------------------------------------------------------------------------------
                        1.1s (1.5% of total time) in 21 GCs | Peak RSS: 5.38GB | CPU load: 6.49
------------------------------------------------------------------------------------------------------------------------
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 12s.
2022-09-23 11:59:12.583 INFO  [o.g.t.i.AppReproducersTest] (imageioAWT) Running...
[ERROR] imageioAWTTest{TestInfo}  Time elapsed: 83.193 s  <<< FAILURE!
org.opentest4j.AssertionFailedError: 
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, 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, libmanagement_ext.a, libnet.a, libnio.a, libzip.a] ==> expected: <true> but was: <false>
    at org.graalvm.tests.integration.AppReproducersTest.imageioAWT(AppReproducersTest.java:481)
    at org.graalvm.tests.integration.AppReproducersTest.imageioAWTTest(AppReproducersTest.java:362)
zakkak commented 1 year ago

Hmm, I was able to reproduce with an updated graal/master. I also now see the failure in the last nighlty run, and one from 3 days ago.

It looks like there is a high number of runs timing out, e.g. https://github.com/graalvm/mandrel/actions/runs/3102777823 as well.

Update:

The first failing CI run was https://github.com/graalvm/mandrel/actions/runs/3005013658/jobs/4825038158#step:10:48 Last working was https://github.com/graalvm/mandrel/actions/runs/2997485008/jobs/4809277426#step:10:48

I am bisecting to see which change caused the regression...

Update 2:

The commit that caused the regression is https://github.com/oracle/graal/commit/2e3a0ae220f202be8f92f8738b9ba3aea57aea7d

To my (limited I admit) understanding this is a bug fix that results in a more sound reachability analysis which also results in the analysis seeing that com.sun.management.internal.OperatingSystemImpl is reachable in this case. Note: I have not confirmed whether this class is actually reachable or not when running in JVM mode.

jerboaa commented 1 year ago

It doesn't seem to be reachable in JVM mode (traced with -Xlog:class+load=info) and I'm not sure why it ends up in the image (management_ext.a).