JDK-6958221 : java.awt.Font.getFamily() leads to JVM crash on Linux on JDK7 for "custom" fonts
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7
  • Priority: P1
  • Status: Closed
  • Resolution: Fixed
  • OS:
    generic,linux,linux_ubuntu,open_solaris,solaris,solaris_1,solaris_10 generic,linux,linux_ubuntu,open_solaris,solaris,solaris_1,solaris_10
  • CPU: generic,x86,sparc
  • Submitted: 2010-06-03
  • Updated: 2012-03-22
  • Resolved: 2011-03-08
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 7
7 b128Fixed
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Relates :  
Description
Platform:          Linux (Ubuntu 10.04)
FAILS(CRASHES):    JDK 7 (reproduced with b95, exact build where problem was introduced is unknown)
PASSES:            JDK 6

The following code leads to JVM crash:
--------------------------------------
import java.awt.*;
import java.awt.font.*;
import java.awt.geom.*;


public class FontTest {
    public static void main(String[] args) {
        new Font("CustomFontName", java.awt.Font.BOLD, 12).getFamily();

        // the following will also lead to JVM crash
        new Font("CustomFontName", Font.BOLD, 12).createGlyphVector(new FontRenderContext(new AffineTransform(), false, false), "abcd");

        new TextLayout("012", new Font("Helvetica", Font.PLAIN, 12), new FontRenderContext(new AffineTransform(), true, true));

    }
}


------------------------------------------------------------------------
# To suppress the following error report, specify this argument
# after -XX: or in .hotspotrc:  SuppressErrorAt=/jniHandles.hpp:189
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  Internal Error (/BUILD_AREA/jdk7/hotspot/src/share/vm/runtime/jniHandles.hpp:189), pid=1552, tid=3063851888
#  assert(handle != NULL) failed: JNI handle should not be null
#
# JRE version: 7.0-b95
# Java VM: Java HotSpot(TM) Client VM (19.0-b01-fastdebug mixed mode linux-x86 )
# An error report file with more information is saved as:
# /home/sycob/dev/playground/hs_err_pid1552.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#
Current thread is 3063851888
Dumping core ...
------------------------------------------------------------------------
Initally failure occured with Motif L&F
-Dswing.defaultlaf=com.sun.java.swing.plaf.motif.MotifLookAndFeel

And looked the following way

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00dabc27, pid=17279, tid=74648464
#
# JRE version: 7.0-b90
# Java VM: Java HotSpot(TM) Client VM (18.0-b03 mixed mode linux-x86 )
# Problematic frame:
# V  [libjvm.so+0x252c27]
#
# An error report file with more information is saved as:
# /net/jessika/export/jck/qa-results/jck/7/ea/b35/results/promoted/hs_err_pid17279.log
#
# If you would like to submit a bug report, please visit:
#   http://java.sun.com/webapps/bugreport/crash.jsp
#


Was easily reproduced without Motif L&F on Ubuntu 10.04 within VirtualBox
bigapps/runThese/stability fails with same crash

Comments
EVALUATION The test case doesn't crash on Solaris 10 because we happen to initialise the GraphicsEnvironment there as a consequence of it having a standard font properties file. The synthesised one on Ubuntu causes us to skip that path. Whilst I can't see a code path that would cause a similar crash on Solaris 10, I can't 100% rule out there being a way for it to manifest there too. Also many GUI apps will run fine because by their nature they initialise the toolkit and GE first, but I can see that many font focused apps and tests would hit this.
12-01-2011

EVALUATION This isn't really to do with fonts, but the Font code is dependent on the graphics environment being initialised and it isn't. This is failing in getFontPath() in a call to AWT_LOCK() because several JNI handles : tkClass, awtLockMID, awtUnlockMID are not yet initialised. I can see that this test worked as recently as b72 and certainly fails in b76 (can't find 73/74/75 right now) and the relevant change "6795908: ReFactor FontManager" was integrated into b74
04-06-2010

EVALUATION I can reproduce this in an Ubuntu 10.04 VirtualBox image.
03-06-2010

EVALUATION Reads like a hotspot internal error, and since its hotspot 19 build *01* its certainly worth considering that option. And I don't think we've changed JDK 7 font code recently, it could also be that we are incorrectly using null somewhere. Please provide login info for the Ubuntu 10.04 system that demonstrates this bug. That'll save time, particularly if it turns out its partly due to a font on that specific system.
03-06-2010