Bug 1711256 - fontconfig not required for java headless, causes java programs to crash
Summary: fontconfig not required for java headless, causes java programs to crash
Keywords:
Status: CLOSED EOL
Alias: None
Product: Fedora
Classification: Fedora
Component: java-latest-openjdk
Version: 30
Hardware: x86_64
OS: Linux
unspecified
unspecified
Target Milestone: ---
Assignee: Petra Alice Mikova
QA Contact: Fedora Extras Quality Assurance
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-05-17 11:36 UTC by Steffen Mikkelsen
Modified: 2020-05-26 15:22 UTC (History)
4 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-05-26 15:22:29 UTC
Type: Bug


Attachments (Terms of Use)
screenshots and testcase to reproduce issue (59.13 KB, application/zip)
2019-05-17 11:36 UTC, Steffen Mikkelsen
no flags Details
packages installed on system (26.20 KB, text/plain)
2019-05-20 12:56 UTC, Steffen Mikkelsen
no flags Details

Description Steffen Mikkelsen 2019-05-17 11:36:28 UTC
Created attachment 1570050 [details]
screenshots and testcase to reproduce issue

Description of problem:
java-latest-openjdk-headless RPM packagedoes not require fontconfig, however certain java programs will not work unless it is installed.

I suggest fontconfig be added as a dependency to java-latest-openjdk-headless

Version-Release number of selected component (if applicable):
12.0.1.12

How reproducible:
always

Steps to Reproduce:
1. Run attached test program without fontconfig installed.
2. Run attached test program with fontconfig installed.

Actual results:
It crashes without fontconfig

Expected results:
RPM should require fontconfig if it is required to run java programs.

Additional info:

Comment 1 Petra Alice Mikova 2019-05-20 11:07:25 UTC
Hi,

the headless package does not require fontconfig intentionally, because the fontconfig and its dependencies pull in a lot of X packages, that makes the installation 'not so much headless' anymore.

repoquery --requires --recursive --resolve fontconfig | grep X
Last metadata expiration check: 0:02:57 ago on Mon 20 May 2019 11:26:17 AM CEST.
libX11-0:1.6.7-1.fc29.i686
libX11-0:1.6.7-1.fc29.x86_64
libX11-common-0:1.6.7-1.fc29.noarch
libXau-0:1.0.8-14.fc29.i686
libXau-0:1.0.8-14.fc29.x86_64
libXcomposite-0:0.4.4-15.fc29.x86_64
libXcursor-0:1.1.15-4.fc29.x86_64
libXdamage-0:1.1.4-15.fc29.x86_64
libXext-0:1.3.3-10.fc29.x86_64
libXfixes-0:5.0.3-8.fc29.x86_64
libXft-0:2.3.2-11.fc29.x86_64
libXi-0:1.7.9-8.fc29.x86_64
libXinerama-0:1.1.4-2.fc29.x86_64
libXmu-0:1.1.2-12.fc29.x86_64
libXrandr-0:1.5.1-8.fc29.x86_64
libXrender-0:0.9.10-8.fc29.x86_64
libXt-0:1.1.5-9.fc29.x86_64
libXtst-0:1.2.3-8.fc29.x86_64
libXxf86misc-0:1.0.4-2.fc29.x86_64
libXxf86vm-0:1.1.4-10.fc29.x86_64

However, the fontconfig is a dependence of java-latest-openjdk base package, so installing java-latest-openjdk should be the correct solution for your problem.

Comment 2 Steffen Mikkelsen 2019-05-20 11:13:14 UTC
I have tested on a minimal install on Fedora 30 (x86_64) without X11 installed. I do not see any dependencies from fontcontig to any X11 libraries. 
You can also see the dependencies here: https://fedora.pkgs.org/30/fedora-x86_64/fontconfig-2.13.1-6.fc30.x86_64.rpm.html

Comment 3 Petra Alice Mikova 2019-05-20 12:24:27 UTC
Have you also checked the whole dependency tree of fontconfig dependencies? Fontconfig itself does not pull X11, but it's dependencies do, as far as I know. Maybe other people involved in OpenJDK packaging will have more information about this - Severin, Jiri, any thoughts?

Kind regards,

Comment 4 jiri vanek 2019-05-20 12:38:22 UTC
I'm also hesitating with adding the fontconfig to headless depndence:
 repoquery --requires --recursive --resolve  fontconfig | wc -l
953

 repoquery --requires --recursive --resolve  java-1.8.0-openjdk-headless | wc -l
Last metadata expiration check: 0:02:54 ago on Mon 20 May 2019 02:33:30 PM CEST.
342
 repoquery --requires --recursive --resolve  java-1.8.0-openjdk | wc -l
Last metadata expiration check: 0:03:01 ago on Mon 20 May 2019 02:33:30 PM CEST.
994
 repoquery --requires --recursive --resolve  java-latest-openjdk-headless | wc -l
Last metadata expiration check: 0:03:15 ago on Mon 20 May 2019 02:33:30 PM CEST.
328
 repoquery --requires --recursive --resolve  java-latest-openjdk | wc -l
Last metadata expiration check: 0:03:23 ago on Mon 20 May 2019 02:33:30 PM CEST.
979


That is big dependence chain overhead. Maybe jdk can throw better exception? Like "install font config" ?

Comment 5 Steffen Mikkelsen 2019-05-20 12:55:46 UTC
Using your repoquery command I also get a ton of dependencies for fontconfig. 

However when running "dnf install fontconfig" they are not required by dnf. And no the packages are not installed already. 

I have attached the list of installed packages (dnf list installed) on my system so you can see that fontconfig is installed without any X11 dependencies.
 
The dependencies that were installed:
dejavu-fonts-common
dejavu-sans-fonts
fontpackages-filesystem

Comment 6 Steffen Mikkelsen 2019-05-20 12:56:24 UTC
Created attachment 1571278 [details]
packages installed on system

Comment 7 Severin Gehwolf 2019-05-20 13:15:41 UTC
First things first:

$ rpm -q --requires java-latest-openjdk-headless | grep \.so
ld-linux-x86-64.so.2()(64bit)
ld-linux-x86-64.so.2(GLIBC_2.3)(64bit)
nss-softokn(x86-64) >= 3.43.0
$ rpm -q java-latest-openjdk-headless
java-latest-openjdk-headless-12.0.1.12-1.rolling.fc29.x86_64

This is wrong. It's bug 1702324. I'd fix that one for JDK 12 first and re-evaluate.

Comparing JDK 11 (which has this fixed) and JDK 12 I see these differences:

[root@c3a46d32f8e2 /]# java -version
openjdk version "12.0.1" 2019-04-16
OpenJDK Runtime Environment 19.3 (build 12.0.1+12)
OpenJDK 64-Bit Server VM 19.3 (build 12.0.1+12, mixed mode, sharing)
[root@c3a46d32f8e2 /]# java FontConfigTester
java.lang.UnsatisfiedLinkError: /usr/lib/jvm/java-12-openjdk-12.0.1.12-1.rolling.fc29.x86_64/lib/libfontmanager.so: libfreetype.so.6: cannot open shared object file: No such file or directory
	at java.base/java.lang.ClassLoader$NativeLibrary.load0(Native Method)
	at java.base/java.lang.ClassLoader$NativeLibrary.load(ClassLoader.java:2430)
	at java.base/java.lang.ClassLoader$NativeLibrary.loadLibrary(ClassLoader.java:2487)
	at java.base/java.lang.ClassLoader.loadLibrary0(ClassLoader.java:2684)
	at java.base/java.lang.ClassLoader.loadLibrary(ClassLoader.java:2638)
	at java.base/java.lang.Runtime.loadLibrary0(Runtime.java:827)
	at java.base/java.lang.System.loadLibrary(System.java:1902)
	at java.desktop/sun.font.FontManagerNativeLibrary$1.run(FontManagerNativeLibrary.java:57)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
	at java.desktop/sun.font.FontManagerNativeLibrary.<clinit>(FontManagerNativeLibrary.java:32)
	at java.desktop/sun.font.SunFontManager$1.run(SunFontManager.java:270)
	at java.base/java.security.AccessController.doPrivileged(AccessController.java:310)
	at java.desktop/sun.font.SunFontManager.<clinit>(SunFontManager.java:266)
	at FontConfigTester.main(FontConfigTester.java:6)

vs. this for JDK 11:

[root@fc959db559d8 /]# java -version
openjdk version "11.0.3" 2019-04-16
OpenJDK Runtime Environment 18.9 (build 11.0.3+7)
OpenJDK 64-Bit Server VM 18.9 (build 11.0.3+7, mixed mode, sharing)
[root@fc959db559d8 /]# java FontConfigTester
java.lang.InternalError: java.lang.reflect.InvocationTargetException
	at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:86)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/sun.font.FontManagerFactory.getInstance(FontManagerFactory.java:74)
	at java.desktop/sun.font.SunFontManager.getInstance(SunFontManager.java:247)
	at FontConfigTester.main(FontConfigTester.java:6)
Caused by: java.lang.reflect.InvocationTargetException
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
	at java.base/jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:62)
	at java.base/jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:45)
	at java.base/java.lang.reflect.Constructor.newInstance(Constructor.java:490)
	at java.desktop/sun.font.FontManagerFactory$1.run(FontManagerFactory.java:84)
	... 4 more
Caused by: java.lang.NullPointerException
	at java.desktop/sun.awt.FontConfiguration.getVersion(FontConfiguration.java:1262)
	at java.desktop/sun.awt.FontConfiguration.readFontConfigFile(FontConfiguration.java:225)
	at java.desktop/sun.awt.FontConfiguration.init(FontConfiguration.java:107)
	at java.desktop/sun.awt.X11FontManager.createFontConfiguration(X11FontManager.java:719)
	at java.desktop/sun.font.SunFontManager$2.run(SunFontManager.java:367)
	at java.base/java.security.AccessController.doPrivileged(Native Method)
	at java.desktop/sun.font.SunFontManager.<init>(SunFontManager.java:312)
	at java.desktop/sun.awt.FcFontManager.<init>(FcFontManager.java:35)
	at java.desktop/sun.awt.X11FontManager.<init>(X11FontManager.java:56)
	... 9 more

Installing package fontconfig, which drags in at least one font, fixes the issue on JDK 11.

It seems OK to add fontconfig package to the list of required packages for openjdk. Here is the list of additional packages being dragged in for non-headless java-11-openjdk (after fontconfig is already installed):

[root@b7ed920d5e4e /]# dnf install java-11-openjdk
Last metadata expiration check: 0:11:21 ago on Mon 20 May 2019 01:02:37 PM UTC.
Dependencies resolved.
===================================================================================================================================================================================================================
 Package                                                       Architecture                               Version                                                Repository                                   Size
===================================================================================================================================================================================================================
Installing:
 java-11-openjdk                                               x86_64                                     1:11.0.3.7-1.fc29                                      updates                                     221 k
Installing dependencies:
 adwaita-cursor-theme                                          noarch                                     3.30.1-1.fc29                                          updates                                     644 k
 adwaita-icon-theme                                            noarch                                     3.30.1-1.fc29                                          updates                                      11 M
 cairo                                                         x86_64                                     1.16.0-3.fc29                                          updates                                     676 k
 cairo-gobject                                                 x86_64                                     1.16.0-3.fc29                                          updates                                      18 k
 colord-libs                                                   x86_64                                     1.4.4-1.fc29                                           updates                                     208 k
 gdk-pixbuf2                                                   x86_64                                     2.38.1-1.fc29                                          updates                                     456 k
 gdk-pixbuf2-modules                                           x86_64                                     2.38.1-1.fc29                                          updates                                      86 k
 gtk-update-icon-cache                                         x86_64                                     3.24.1-3.fc29                                          updates                                      31 k
 jbigkit-libs                                                  x86_64                                     2.1-15.fc29                                            updates                                      49 k
 libX11                                                        x86_64                                     1.6.7-1.fc29                                           updates                                     593 k
 libX11-common                                                 noarch                                     1.6.7-1.fc29                                           updates                                     155 k
 libproxy                                                      x86_64                                     0.4.15-10.fc29                                         updates                                      64 k
 libsoup                                                       x86_64                                     2.64.2-1.fc29                                          updates                                     340 k
 libtiff                                                       x86_64                                     4.0.10-4.fc29                                          updates                                     166 k
 pango                                                         x86_64                                     1.42.4-2.fc29                                          updates                                     258 k
 shared-mime-info                                              x86_64                                     1.12-1.fc29                                            updates                                     320 k
 at-spi2-atk                                                   x86_64                                     2.30.0-1.fc29                                          fedora                                       77 k
 at-spi2-core                                                  x86_64                                     2.30.0-2.fc29                                          fedora                                      155 k
 atk                                                           x86_64                                     2.30.0-1.fc29                                          fedora                                      257 k
 fribidi                                                       x86_64                                     1.0.5-1.fc29                                           fedora                                       82 k
 giflib                                                        x86_64                                     5.1.4-2.fc29                                           fedora                                       47 k
 glib-networking                                               x86_64                                     2.58.0-2.fc29                                          fedora                                      135 k
 graphite2                                                     x86_64                                     1.3.10-6.fc29                                          fedora                                      108 k
 gsettings-desktop-schemas                                     x86_64                                     3.28.1-2.fc29                                          fedora                                      611 k
 harfbuzz                                                      x86_64                                     1.8.7-1.fc29                                           fedora                                      333 k
 hicolor-icon-theme                                            noarch                                     0.17-3.fc29                                            fedora                                       44 k
 jasper-libs                                                   x86_64                                     2.0.14-7.fc29                                          fedora                                      160 k
 json-glib                                                     x86_64                                     1.4.4-1.fc29                                           fedora                                      137 k
 libXau                                                        x86_64                                     1.0.8-14.fc29                                          fedora                                       29 k
 libXcomposite                                                 x86_64                                     0.4.4-15.fc29                                          fedora                                       22 k
 libXcursor                                                    x86_64                                     1.1.15-4.fc29                                          fedora                                       29 k
 libXdamage                                                    x86_64                                     1.1.4-15.fc29                                          fedora                                       21 k
 libXext                                                       x86_64                                     1.3.3-10.fc29                                          fedora                                       38 k
 libXfixes                                                     x86_64                                     5.0.3-8.fc29                                           fedora                                       18 k
 libXft                                                        x86_64                                     2.3.2-11.fc29                                          fedora                                       59 k
 libXi                                                         x86_64                                     1.7.9-8.fc29                                           fedora                                       38 k
 libXinerama                                                   x86_64                                     1.1.4-2.fc29                                           fedora                                       14 k
 libXrandr                                                     x86_64                                     1.5.1-8.fc29                                           fedora                                       26 k
 libXrender                                                    x86_64                                     0.9.10-8.fc29                                          fedora                                       26 k
 libXtst                                                       x86_64                                     1.2.3-8.fc29                                           fedora                                       20 k
 libdatrie                                                     x86_64                                     0.2.9-8.fc29                                           fedora                                       31 k
 libepoxy                                                      x86_64                                     1.5.3-1.fc29                                           fedora                                      197 k
 libfontenc                                                    x86_64                                     1.1.3-9.fc29                                           fedora                                       30 k
 libgusb                                                       x86_64                                     0.3.0-2.fc29                                           fedora                                       45 k
 libmodman                                                     x86_64                                     2.0.1-18.fc29                                          fedora                                       33 k
 libpkgconf                                                    x86_64                                     1.5.3-2.fc29                                           fedora                                       35 k
 libthai                                                       x86_64                                     0.1.28-1.fc29                                          fedora                                      199 k
 libwayland-client                                             x86_64                                     1.16.0-1.fc29                                          fedora                                       31 k
 libwayland-cursor                                             x86_64                                     1.16.0-1.fc29                                          fedora                                       19 k
 libwayland-egl                                                x86_64                                     1.16.0-1.fc29                                          fedora                                       13 k
 libxcb                                                        x86_64                                     1.13.1-1.fc29                                          fedora                                      201 k
 libxkbcommon                                                  x86_64                                     0.8.2-1.fc29                                           fedora                                      109 k
 pixman                                                        x86_64                                     0.34.0-10.fc29                                         fedora                                      253 k
 pkgconf                                                       x86_64                                     1.5.3-2.fc29                                           fedora                                       39 k
 pkgconf-m4                                                    noarch                                     1.5.3-2.fc29                                           fedora                                       17 k
 pkgconf-pkg-config                                            x86_64                                     1.5.3-2.fc29                                           fedora                                       15 k
 rest                                                          x86_64                                     0.8.1-4.fc29                                           fedora                                       65 k
 ttmkfdir                                                      x86_64                                     3.0.9-55.fc29                                          fedora                                       53 k
 xkeyboard-config                                              noarch                                     2.24-4.fc29                                            fedora                                      822 k
 xorg-x11-font-utils                                           x86_64                                     1:7.5-40.fc29                                          fedora                                       95 k
 xorg-x11-fonts-Type1                                          noarch                                     7.5-20.fc29                                            fedora                                      517 k
Installing weak dependencies:
 dconf                                                         x86_64                                     0.30.1-1.fc29                                          updates                                      93 k
 gtk3                                                          x86_64                                     3.24.1-3.fc29                                          updates                                     4.5 M

Transaction Summary
===================================================================================================================================================================================================================
Install  64 Packages

Total download size: 25 M
Installed size: 76 M

Comment 10 Ben Cotton 2020-04-30 21:58:03 UTC
This message is a reminder that Fedora 30 is nearing its end of life.
Fedora will stop maintaining and issuing updates for Fedora 30 on 2020-05-26.
It is Fedora's policy to close all bug reports from releases that are no longer
maintained. At that time this bug will be closed as EOL if it remains open with a
Fedora 'version' of '30'.

Package Maintainer: If you wish for this bug to remain open because you
plan to fix it in a currently maintained version, simply change the 'version' 
to a later Fedora version.

Thank you for reporting this issue and we are sorry that we were not 
able to fix it before Fedora 30 is end of life. If you would still like 
to see this bug fixed and are able to reproduce it against a later version 
of Fedora, you are encouraged  change the 'version' to a later Fedora 
version prior this bug is closed as described in the policy above.

Although we aim to fix as many bugs as possible during every release's 
lifetime, sometimes those efforts are overtaken by events. Often a 
more recent Fedora release includes newer upstream software that fixes 
bugs or makes them obsolete.

Comment 11 Ben Cotton 2020-05-26 15:22:29 UTC
Fedora 30 changed to end-of-life (EOL) status on 2020-05-26. Fedora 30 is
no longer maintained, which means that it will not receive any further
security or bug fix updates. As a result we are closing this bug.

If you can reproduce this bug against a currently maintained version of
Fedora please feel free to reopen this bug against that version. If you
are unable to reopen this bug, please file a new report against the
current release. If you experience problems, please add a comment to this
bug.

Thank you for reporting this bug and we are sorry it could not be fixed.


Note You need to log in before you can comment on or make changes to this bug.