JDK-8226654 : Some swing gtk regression tests fail with "java.lang.InternalError: Unable to load native GTK libraries"
  • Type: Bug
  • Component: client-libs
  • Sub-Component: java.awt
  • Affected Version: 13,14
  • Priority: P2
  • Status: Closed
  • Resolution: Fixed
  • OS: linux
  • CPU: generic
  • Submitted: 2019-06-24
  • Updated: 2021-10-16
  • Resolved: 2019-07-07
The Version table provides details related to the release that this issue/RFE will be addressed.

Unresolved : Release in which this issue/RFE will be addressed.
Resolved: Release in which this issue/RFE has been resolved.
Fixed : Release in which this issue/RFE has been fixed. The release containing this fix may be available for download as an Early Access Release or a General Availability Release.

To download the current JDK release, click here.
JDK 13 JDK 14
13 b29Fixed 14Fixed
Related Reports
Relates :  
Description
openjdk version "13-ea" 2019-09-17
OpenJDK Runtime Environment (build 13-ea+25)
OpenJDK 64-Bit Server VM (build 13-ea+25, mixed mode, sharing)

Platform Details:
javatestOS=Linux 3.8.13-118.34.1.el7uek.x86_64 (amd64)

Failing tests:
com/sun/java/swing/plaf/gtk/4928019/bug4928019.java
com/sun/java/swing/plaf/gtk/Test6635110.java
com/sun/java/swing/plaf/gtk/Test6963870.java

Error Message:
----------System.err:(16/1077)----------
java.lang.InternalError: Unable to load native GTK libraries
	at java.desktop/com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initialize(GTKLookAndFeel.java:1421)
	at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:586)
	at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:633)
	at bug4928019.main(bug4928019.java:37)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.base/java.lang.reflect.Method.invoke(Method.java:567)
	at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127)
	at java.base/java.lang.Thread.run(Thread.java:830)

JavaTest Message: Test threw exception: java.lang.InternalError: Unable to load native GTK libraries
JavaTest Message: shutting down test

STATUS:Failed.`main' threw exception: java.lang.InternalError: Unable to load native GTK libraries

Regression Details:
This issue started from JDK 13 build 25, same test cases pass on JDK 13 build 24.
Issue is reproducible in JDK14 also.
Comments
URL: http://hg.openjdk.java.net/jdk/jdk13/rev/040cb8bf265e User: prr Date: 2019-07-07 17:55:28 +0000
07-07-2019

Webrev: http://cr.openjdk.java.net/~avu/JDK-8226654/webrev.00 Review: http://mail.openjdk.java.net/pipermail/awt-dev/2019-July/015294.html Approved by [~prr] and [~psadhukhan] to push to jdk13 forked repo
05-07-2019

We're looking on this regression. Hopefully, the issue will be resolved soon.
02-07-2019

[~ant] [~avu] in case no response next 2 weeks, we are going to rollback your fix of JDK-8225118 which caused THIS regression. We are on JDK 13 stabilization and needs to resolve this issue by RDP2: http://openjdk.java.net/projects/jdk/13/#Schedule
28-06-2019

Anton we need this resolved in JDK 13.
25-06-2019

We already have a check for gtk version in the gtk3_interface.c ============= if (fp_gtk_check_version(3, 10, 0)) { gtk3_version_3_10 = FALSE; } else { fp_gdk_window_create_similar_image_surface = dl_symbol("gdk_window_create_similar_image_surface"); } gtk3_version_3_14 = !fp_gtk_check_version(3, 14, 0); if (!fp_gtk_check_version(3, 20, 0)) { gtk3_version_3_20 = TRUE; fp_gtk_widget_path_copy = dl_symbol("gtk_widget_path_copy"); fp_gtk_widget_path_new = dl_symbol("gtk_widget_path_new"); fp_gtk_widget_path_append_type = dl_symbol("gtk_widget_path_append_type"); fp_gtk_widget_path_iter_set_object_name = dl_symbol("gtk_widget_path_iter_set_object_name"); fp_gtk_style_context_set_path = dl_symbol("gtk_style_context_set_path"); fp_gtk_widget_path_unref = dl_symbol("gtk_widget_path_unref"); fp_gtk_style_context_get_path = dl_symbol("gtk_style_context_get_path"); fp_gtk_style_context_new = dl_symbol("gtk_style_context_new"); } ============= So we need to load the symbol in question under the gtk3_version_3_10 check.
25-06-2019

Or we can try to make this particular symbol not being there survivable, if OL 7.0 is a supported version. Backing out https://bugs.openjdk.java.net/browse/JDK-8225118 is an option but not a great one since it is important for testing.
25-06-2019

The system you are testing on has some ancient version of the GTK3 libraries that are 6 (!?) years old. And they were even installed 4 years ago. This system appears like to have been "upgraded" from an older release and only the kernel related parts were upgraded. The UI libraries are ancient. The 3.8.8 we have here doesn't seem to have the required symbol. date: 2013-01-04 14:21:22 +0100 Name : gtk3 Version : 3.8.8 Release : 10.el7 Architecture: x86_64 Install Date: Wed 05 Aug 2015 03:44:42 AM PDT Group : System Environment/Libraries Size : 12967664 License : LGPLv2+ Signature : RSA/SHA256, Fri 06 Mar 2015 09:57:50 PM PST, Key ID 72f97b74ec551f03 I am not sure how to handle this. Once we've loaded GTK3 and found it is too old, I don't know if we can unload it and go back to GTK2. We can also document a minimum required GTK3 ...
25-06-2019

I've spotted one thing. https://bugs.openjdk.java.net/browse/JDK-8225118 at first didn't look like it could affect loading but actually it can. If the symbol gdk_window_get_scale_factor isn't found we'll longjmp out of loading the library. This was introduced in GDK 3.10 : https://developer.gnome.org/gdk3/stable/gdk3-Windows.html#gdk-window-get-scale-factor
25-06-2019

Could something be causing GTK2 to be loaded already ? We would not be able to load GTK3 in such a case. Does it pass if run directly rather than in jtreg ?
25-06-2019

So it fails for you with jdk13 b25 on a OL 7.6 VM but it passes for me with the same setup - a 7.6 VM running in virtualbox in my case. GTK3 must be there since you report above it is loaded by b24 And b25 is able to load GTK2 when specified directly but seems like it can't fall back to GTK2 when trying to load GTK3. I can't make sense of this.
25-06-2019

https://bugs.openjdk.java.net/browse/JDK-8226697 is just something I noticed when trying to reproduce as I could not find the test results from our nightlies because they lacked the @headful keyword. Adding that doesn't affect the test being run directly.
25-06-2019

I tried with fix of JDK-8226697, by adding @key headful, still it fails.
25-06-2019

I guess it is already fixed by JDK-8226697
25-06-2019

Interestingly it passes with option -Djdk.gtk.version=2 on JDK 13 b25 Output log: ----------System.out:(1/5)---------- DONE ----------System.err:(3/64)---------- Looking for GTK2 library... GTK2 library loaded. STATUS:Passed.
25-06-2019

Output with -Djdk.gtk.verbose=true : JDK 13 b24: ----------System.out:(1/5)---------- DONE ----------System.err:(3/64)---------- Looking for GTK3 library... GTK3 library loaded. STATUS:Passed. JDK 13 b25: ----------System.out:(0/0)---------- ----------System.err:(18/1133)---------- Looking for GTK3 library... Failed to load GTK library. java.lang.InternalError: Unable to load native GTK libraries at java.desktop/com.sun.java.swing.plaf.gtk.GTKLookAndFeel.initialize(GTKLookAndFeel.java:1421) at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:586) at java.desktop/javax.swing.UIManager.setLookAndFeel(UIManager.java:633) at bug4928019.main(bug4928019.java:37) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method) at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62) at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43) at java.base/java.lang.reflect.Method.invoke(Method.java:567) at com.sun.javatest.regtest.agent.MainWrapper$MainThread.run(MainWrapper.java:127) at java.base/java.lang.Thread.run(Thread.java:830) JavaTest Message: Test threw exception: java.lang.InternalError: Unable to load native GTK libraries JavaTest Message: shutting down test STATUS:Failed.`main' threw exception: java.lang.InternalError: Unable to load native GTK libraries
25-06-2019

OS Details: NAME="Oracle Linux Server" VERSION="7.6" ID="ol" VARIANT="Server" VARIANT_ID="server" VERSION_ID="7.6" PRETTY_NAME="Oracle Linux Server 7.6" It's a VM.
25-06-2019

And these tests pass for me on OL 7.6
24-06-2019

I can't see anything in JDK 13 b25 that could cause such a problem I used this query : project = JDK AND fixVersion = "13" AND component = client-libs AND "Resolved In Build" = b25 > javatestOS=Linux 3.8.13-118.34.1.el7uek.x86_64 (amd64) That's a kernel version. What is the OS ? Please provide a pointer to the system on which this issue is seen. Also run it with both b24 and b25 specifying : java -Djdk.gtk.verbose=true and add the results here.
24-06-2019