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

AppReproducersTest.imageioAWTTest fails with 23.0.0-dev tree after AWT change #143

Closed
jerboaa opened this issue Mar 3, 2023 · 10 comments · Fixed by #146
Closed

AppReproducersTest.imageioAWTTest fails with 23.0.0-dev tree after AWT change #143

jerboaa opened this issue Mar 3, 2023 · 10 comments · Fixed by #146
Assignees

Comments

@jerboaa
Copy link
Collaborator

jerboaa commented Mar 3, 2023

imageio integration test fails with a JDK 20-based 23.0.0-dev mandrel build like so:

 Error:  Failures: 
Error:    AppReproducersTest.imageioAWTTest:493->imageioAWT:593 There were errors checking the generated image files, see:
mytest.jpg was not generated.
mytest_toL.png was not generated.
mytest.bmp was not generated.
mytest_toG.png was not generated.
mytest.gif was not generated.
mytest.svg was not generated.
mytest.png was not generated.
mytest.tiff was not generated.
mytest_Resized_Grace_M._Hopper.png was not generated.
mytest_toC.png was not generated.
mytest_toP.png was not generated.
mytest.wbmp was not generated.
mytest_toS.png was not generated. ==> expected: <true> but was: <false>
[INFO] 
Error:  Tests run: 18, Failures: 1, Errors: 0, Skipped: 5

See: https://github.com/graalvm/mandrel/actions/runs/4320017354/jobs/7540073635#step:10:13029

@jerboaa
Copy link
Collaborator Author

jerboaa commented Mar 3, 2023

imageioAWTTest/build-and-run.log has more details, namely:

Exception in thread "main" java.lang.UnsatisfiedLinkError: no awt in java.library.path
        at org.graalvm.nativeimage.builder/com.oracle.svm.core.jdk.NativeLibrarySupport.loadLibraryRelative(NativeLibrarySupport.java:136)
        at java.base@20-beta/java.lang.ClassLoader.loadLibrary(ClassLoader.java:50)
        at java.base@20-beta/java.lang.Runtime.loadLibrary0(Runtime.java:880)
        at java.base@20-beta/java.lang.System.loadLibrary(System.java:2051)
        at java.desktop@20-beta/java.awt.Toolkit$2.run(Toolkit.java:1384)
        at java.desktop@20-beta/java.awt.Toolkit$2.run(Toolkit.java:1382)
        at java.base@20-beta/java.security.AccessController.executePrivileged(AccessController.java:171)
        at java.base@20-beta/java.security.AccessController.doPrivileged(AccessController.java:319)
        at java.desktop@20-beta/java.awt.Toolkit.loadLibraries(Toolkit.java:1381)
        at java.desktop@20-beta/java.awt.Toolkit.initStatic(Toolkit.java:1419)
        at java.desktop@20-beta/java.awt.Toolkit.<clinit>(Toolkit.java:1393)
        at java.base@20-beta/java.lang.Class.ensureInitialized(DynamicHub.java:550)
        at java.desktop@20-beta/sun.awt.AppContext$2.run(AppContext.java:273)
        at java.desktop@20-beta/sun.awt.AppContext$2.run(AppContext.java:262)
        at java.base@20-beta/java.security.AccessController.executePrivileged(AccessController.java:171)
        at java.base@20-beta/java.security.AccessController.doPrivileged(AccessController.java:319)
        at java.desktop@20-beta/sun.awt.AppContext.initMainAppContext(AppContext.java:262)
        at java.desktop@20-beta/sun.awt.AppContext$3.run(AppContext.java:315)
        at java.desktop@20-beta/sun.awt.AppContext$3.run(AppContext.java:298)
        at java.base@20-beta/java.security.AccessController.executePrivileged(AccessController.java:171)
        at java.base@20-beta/java.security.AccessController.doPrivileged(AccessController.java:319)
        at java.desktop@20-beta/sun.awt.AppContext.getAppContext(AppContext.java:297)
        at java.desktop@20-beta/javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:123)
        at java.desktop@20-beta/javax.imageio.ImageIO.<clinit>(ImageIO.java:64)
        at imageio.Main.paintGrace(Main.java:70)
        at imageio.Main.main(Main.java:189)

See also: quarkusio/quarkus#31596

@jerboaa jerboaa changed the title AppReproducersTest.imageioAWTTest fails with JDK 20 ea and 23.0.0-dev tree AppReproducersTest.imageioAWTTest fails with 23.0.0-dev tree after AWT change Mar 6, 2023
@jerboaa
Copy link
Collaborator Author

jerboaa commented Mar 6, 2023

Failure seen with JDK 17-based build too. Updated the summary.

@jerboaa jerboaa self-assigned this Apr 7, 2023
@jerboaa
Copy link
Collaborator Author

jerboaa commented Apr 7, 2023

With graalvm/mandrel#487 fixed, this should be fairly easy to fix. I'm looking into it.

@jerboaa
Copy link
Collaborator Author

jerboaa commented Apr 7, 2023

With all the fixes in we now get (i.e. this is the current cause of test failure):

$ ./imageio 
Exception in thread "main" java.lang.NoClassDefFoundError: sun/awt/SunToolkit
	at org.graalvm.nativeimage.builder/com.oracle.svm.core.jni.functions.JNIFunctions.FindClass(JNIFunctions.java:352)
	at [email protected]/sun.awt.X11GraphicsEnvironment.initDisplay(Native Method)
	at [email protected]/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:101)
	at [email protected]/java.security.AccessController.executePrivileged(AccessController.java:127)
	at [email protected]/java.security.AccessController.doPrivileged(AccessController.java:318)
	at [email protected]/sun.awt.X11GraphicsEnvironment.<clinit>(X11GraphicsEnvironment.java:60)
	at [email protected]/sun.awt.PlatformGraphicsInfo.createGE(PlatformGraphicsInfo.java:36)
	at [email protected]/java.awt.GraphicsEnvironment$LocalGE.createGE(GraphicsEnvironment.java:93)
	at [email protected]/java.awt.GraphicsEnvironment$LocalGE.<clinit>(GraphicsEnvironment.java:84)
	at [email protected]/java.awt.GraphicsEnvironment.getLocalGraphicsEnvironment(GraphicsEnvironment.java:106)
	at [email protected]/java.awt.image.BufferedImage.createGraphics(BufferedImage.java:1182)
	at [email protected]/java.awt.image.ColorConvertOp.ICCBIFilter(ColorConvertOp.java:332)
	at [email protected]/java.awt.image.ColorConvertOp.filter(ColorConvertOp.java:277)
	at imageio.Main.lambda$paintGrace$0(Main.java:79)
	at [email protected]/java.util.Map.forEach(Map.java:713)
	at imageio.Main.paintGrace(Main.java:77)
	at imageio.Main.main(Main.java:189)

@jerboaa
Copy link
Collaborator Author

jerboaa commented Apr 7, 2023

at [email protected]/sun.awt.X11GraphicsEnvironment$1.run(X11GraphicsEnvironment.java:101) is in the headful code, so this cannot be. We want to run headless.

Running with headless yields a different error:

$ ./imageio -Djava.awt.headless=true
Exception in thread "main" java.io.IOException: Problem reading font data.
	at [email protected]/java.awt.Font.createFont0(Font.java:1208)
	at [email protected]/java.awt.Font.createFont(Font.java:1076)
	at imageio.Main.loadFonts(Main.java:135)
	at imageio.Main.paintRectangles(Main.java:93)
	at imageio.Main.main(Main.java:190)

@zakkak
Copy link
Collaborator

zakkak commented Apr 7, 2023

@jerboaa AFAIK this is being worked in quarkusio/quarkus#32432

@jerboaa
Copy link
Collaborator Author

jerboaa commented Apr 7, 2023

Thanks, yes. Taking inspiration from there.

@jerboaa
Copy link
Collaborator Author

jerboaa commented Apr 7, 2023

This sequence worked for me:

mvn clean package
rm -rf ~/.java/fonts/ && \
rm -rf src/main/resources/META-INF/native-image && \
$MANDREL_HOME/bin/java -Djava.awt.headless=true -agentlib:native-image-agent=config-output-dir=src/main/resources/META-INF/native-image -jar target/imageio.jar
$MANDREL_HOME/bin/jar uf target/imageio.jar -C src/main/resources/ META-INF
$MANDREL_HOME/bin/native-image --verbose -J-Djava.awt.headless=true -H:IncludeResources="Grace_M._Hopper.jp2,MyFreeMono.ttf,MyFreeSerif.ttf,.*/iio-plugin.*properties$,.*/.*pf$" \
	--no-fallback -H:Log=registerResource:3 -jar target/imageio.jar target/imageio
mkdir ./target/lib && touch ./target/lib/fontconfig.properties && \
	cd target && ./imageio -Djava.awt.headless=true -Djava.home=$(pwd)

@jerboaa
Copy link
Collaborator Author

jerboaa commented Apr 11, 2023

PR with proposed fixes in #146

@Karm Karm closed this as completed in #146 Apr 11, 2023
@jerboaa
Copy link
Collaborator Author

jerboaa commented Apr 12, 2023

Note that we still see failures of this test with JDK 20 (20.0.1 specifically). That's due to graalvm/mandrel#487. The OpenJDK fix is in 17.0.7 (April) and 20.0.2 (July).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants