JDK-8160664 : JVM crashed with font manager on Solaris 12
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 6u31
  • Priority: P3
  • Status: Resolved
  • Resolution: Fixed
  • OS: solaris_12
  • Submitted: 2016-06-30
  • Updated: 2017-11-29
  • Resolved: 2016-07-27
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.
7u111Fixed 8u152Fixed 9 b131Fixed
JVM crashes on Solaris 12 when running the following testcase:

------- Source Code -------
import java.awt.Font;
import java.awt.GraphicsEnvironment;

public class Family {
    public static void main(String[] args) throws Exception {
        Font[] fonts  = GraphicsEnvironment.getLocalGraphicsEnvironment().getAllFonts();
        for (int i = 0; i < fonts.length; i++) {
------- End Source Code -------

# A fatal error has been detected by the Java Runtime Environment:
#  SIGSEGV (0xb) at pc=0xb6a502bc, pid=1701, tid=2
# JRE version: 6.0_31-b04
# Java VM: Java HotSpot(TM) Server VM (20.6-b01 mixed mode solaris-sparc )
# Problematic frame:
# C  [libmawt.so+0x202bc]  getFontConfigLocations+0x1b8
# An error report file with more information is saved as:
# hs_err_pid1701.log
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.

The above JVM coredump issue in NOT seen on another server with OS Solaris 12. After comparison, an suspicious package (x11/library/libfontenc) is found missing. With the package installed, the above issue is NOT reproducible.
No plans to address for JDK 6, hence 6-wnf.

Right, "noreg-FOO" labels are our way of saying no regression test was pushed with the fix. the "FOO" is then one of a set of pre-defined approximate reasons and "hard" is one of the most common reasons used.

I think Alan meant the bug is easily reproduced. Creating a test is not possible because this is a system configuration issue. In one config it crashes. In all others it does not. So unless SQE is willing to dedicate a misconfigured Solaris 12 system for the rest of history in order to verify this bug on an ongoing basis there is no point. And even then any of one thousand existing tests will reproduce it *if you have that misconfiguration*. So that is another reason no new test is needed.

The regression test is hard to develop because a specific OS configuration is required where /usr/share/fonts does not exist. This folder is examined by FcFontList() function provided by "fontconfig" library on the system. A test cannot create or remove this folder because /usr/share is usually read-only or requires root privileges. On Solaris 12, folder /usr/share/fonts proved to be missing by default. There's no other known way to make FcFontList() return NULL.

Font debug output

Revised comment based on further findings. So from further tests, this issue seems more visible in 32-bit JVMs. When running my tests on 64-bit Java, FcFontList() seems to return an empty struct instead of NULL. As it is still possible for the function to return NULL, the NULL checks should still be added.

For older Java releases that cannot be patched, the Java IPS packaging needs to be modified to either make sure /usr/share/fonts is created, or to add a dependency on the relevant IPS packages that populate /usr/share/fonts. This will need to be picked up by Java Release Engineering.

Suggested fix

The root cause of the problem is that /usr/share/fonts is not installed by default on Solaris 12. The function FcFontList() from libfontconfig returns NULL if that directory is absent, even though it's not documented as a possible return value: https://www.freedesktop.org/software/fontconfig/fontconfig-devel/fcfontlist.html https://cgit.freedesktop.org/fontconfig/tree/src/fclist.c#n591 FcFontList() is called from getFontConfigLocations() in jdk/src/solaris/native/sun/awt/fontpath.c and doesn't include a check for a NULL return from FcFontList(). A NULL check needs to be added.