-
Notifications
You must be signed in to change notification settings - Fork 2.7k
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
Avoid getting the GraalVM version at deployment time for AWT #43829
Avoid getting the GraalVM version at deployment time for AWT #43829
Conversation
I'm sorry for the noise, I've just realized this is a draft. I'm gonna wait how it unfolds first. Btw, testing with runtime container too, which is not a part of the regular GHA here, is a good thing to try with changes:
|
2d575aa
to
942c089
Compare
This comment has been minimized.
This comment has been minimized.
if (JavaVersionUtil.isJava19OrHigher()) { | ||
try { | ||
RuntimeJNIAccess.register(Class.forName("sun.font.FontUtilities")); | ||
} catch (ClassNotFoundException e) { | ||
throw new RuntimeException(e); | ||
} | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Question: we are still supporting GraalVM/Mandrel for Java 17 in Quarkus 3.17+?
I thought we had all sorts of issues with it?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
OK. FWIW I'm in favor of dropping it whenever you feel comfortable.
@Karm any chance you could have a look at this one before next Tuesday? I'd let to get all these relatively closely related patches into 3.16 if possible. |
@gsmet Yes, I'll do that. Bumping the priority. |
Adjusting priority for my human worker @Karm |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
False Negatives
I took a look and it seems that it's hard to verify any AWT related changes as the test have been disabled for some time. At least since this I guess?
One would assume that -DskipITs
might control the failsafe, but it's not the case. Both in-container and hosted tests are skipped. The harness builds the native image but doesn't run any tests with it. In case of in-container tests, the harness builds the naitive-image, builds a container image and copies the executable in it, starts the container, but doesn't do any testing with it.
I had to manually change:
diff --git a/integration-tests/awt/pom.xml b/integration-tests/awt/pom.xml
index f71302da2c2..eb290a5e037 100644
--- a/integration-tests/awt/pom.xml
+++ b/integration-tests/awt/pom.xml
@@ -164,7 +164,7 @@
<plugin>
<artifactId>maven-failsafe-plugin</artifactId>
<configuration>
- <skip>true</skip>
+ <skip>false</skip>
</configuration>
</plugin>
</plugins>
This PR branch fails 🔴
To obtain results.
In case of this PR branch, HEAD 942c089, and host JDK 17.0.13 and Builder image version: Mandrel-23.1.4.0-Final (build 21.0.4+7-LTS) I got a failure that indicates that different images than expected were generated. Usual failure is that fonts weren't loaded so that's why pixels differ where text was supposed to be. I am yet to dump those images to take a look.
[ERROR] Failures:
[ERROR] ImageGeometryFontsIT>ImageGeometryFontsTest.testGeometryAndFonts:89 TIFF: Wrong pixel at 80x56. Expected: [46,14,32,255] Actual: [194,59,132,255] ==> expected: <true> but was: <false>
[ERROR] ImageGeometryFontsIT>ImageGeometryFontsTest.testGeometryAndFonts:89 GIF: Wrong pixel at 80x56. Expected: [2,0,0,0] Actual: [156,0,0,0] ==> expected: <true> but was: <false>
[ERROR] ImageGeometryFontsIT>ImageGeometryFontsTest.testGeometryAndFonts:89 PNG: Wrong pixel at 80x56. Expected: [46,14,32,255] Actual: [194,59,132,255] ==> expected: <true> but was: <false>
[ERROR] ImageGeometryFontsIT>ImageGeometryFontsTest.testGeometryAndFonts:89 JPG: Wrong pixel at 80x56. Expected: [73,0,44,0] Actual: [201,53,137,0] ==> expected: <true> but was: <false>
[ERROR] ImageGeometryFontsIT>ImageGeometryFontsTest.testGeometryAndFonts:89 BMP: Wrong pixel at 80x56. Expected: [46,14,32,0] Actual: [194,59,132,0] ==> expected: <true> but was: <false>
[INFO]
[ERROR] Tests run: 41, Failures: 5, Errors: 0, Skipped: 0
[INFO]
The failure is the same when I had the test run locally, with Mandrel installed locally (Mandrel-23.1.4.0-Final (build 21.0.4+7-LTS)).
Q 3.15.1 Passes 🟢
When I built & ran Quarkus 3.15.1
with the same change:
- <skip>true</skip>
+ <skip>false</skip>
the test passes though. Mandrel-23.1.4.0-Final (build 21.0.4+7-LTS)
both locally and as a builder-image. So I suspect it's really fonts and related to this change.
|
||
// Added for JDK 19+ due to: https://github.com/openjdk/jdk20/commit/9bc023220 calling FontUtilities | ||
if (v.jdkVersionGreaterOrEqualTo("19")) { | ||
classes.add("sun.font.FontUtilities"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@zakkak So this is meant like a cleanup for JDK 21+ only , right?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's moved to the new AwtFeature (https://github.com/quarkusio/quarkus/pull/43829/files#diff-086ee2e4b2043822961920521dd5be21c10c6805629f87f5b79d5836eb978e28R14).
The idea is to avoid version checks at Quarkus deployment phase (were we are still not sure what GraalVM version will be used).
|
||
// Added for JDK 19+ due to: https://github.com/openjdk/jdk20/commit/9bc023220 calling FontUtilities | ||
if (v.jdkVersionGreaterOrEqualTo("19")) { | ||
classes.add("sun.font.FontUtilities"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, that's moved to the new AwtFeature (https://github.com/quarkusio/quarkus/pull/43829/files#diff-086ee2e4b2043822961920521dd5be21c10c6805629f87f5b79d5836eb978e28R14).
The idea is to avoid version checks at Quarkus deployment phase (were we are still not sure what GraalVM version will be used).
if (v.javaVersion.feature() != 19) { | ||
classes.add("java.awt.GraphicsEnvironment"); | ||
classes.add("sun.awt.X11GraphicsConfig"); | ||
classes.add("sun.awt.X11GraphicsDevice"); | ||
classes.add("sun.java2d.SunGraphicsEnvironment"); | ||
classes.add("sun.java2d.xr.XRSurfaceData"); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@Karm these are cleanup, as we no longer support JDK 19, so I always include these classes
804d230
to
fddb6d2
Compare
fddb6d2 still fails for me. |
fddb6d2
to
b95789b
Compare
I managed to reproduce (and fix) the issue. PTAL when you can. |
WIP... |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
So, with the change at b95789b I can say that the test passes with:
- JDK 17.0.13 and native-image in builder image Mandrel-23.1.4.0-Final
- JDK 17.0.13 and native-image locally Mandrel-23.1.5.0-Final (build 21.0.5+11-LTS)
- both local and in-container testing is ok
- it's also fine to have JDK 21 on both ends
- JDK 17.0.13 and native-image Mandrel-24.1.1.0-Final (build 23.0.1+11) is ok.
What fails is the very latest early access JDK 24 and Mandrel master on fonts dir lookup:
Caused by: java.io.IOException: Problem reading font data.
at java.desktop@24-beta/java.awt.Font.createFont0(Font.java:1205)
at java.desktop@24-beta/java.awt.Font.createFont(Font.java:1076)
at io.quarkus.awt.it.Application.init(Application.java:63)
it is unrelated to this PR though, it fails with 3.15.1 too. I need to port the substitution to the latest JDK.
THX @zakkak 🙏
This comment has been minimized.
This comment has been minimized.
The mongodb failures seem unrelated. |
Reduces the times we start a container when using a builder-image