JDK-6925899 : Crash in Java_sun_awt_X11FontManager_getFontPath on Ubuntu 9.10
  • Type: Bug
  • Component: client-libs
  • Sub-Component: 2d
  • Affected Version: 7
  • Priority: P2
  • Status: Closed
  • Resolution: Duplicate
  • OS:
    generic,open_solaris,solaris_1,solaris_10 generic,open_solaris,solaris_1,solaris_10
  • CPU: generic,x86,sparc
  • Submitted: 2010-02-12
  • Updated: 2012-03-22
  • Resolved: 2011-01-13
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
7Resolved
Related Reports
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Duplicate :  
Description
A crash is observed on 32-bit Ubuntu 8.04 and 9.04 systems:

Stack: [0xb7202000,0xb7253000],  sp=0xb72511a0,  free space=13cb7250b34k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0x3aa747]
V  [libjvm.so+0x3a62d3]
C  [libmawt.so+0x235c3]  Java_sun_awt_X11FontManager_getFontPath+0x6c3
j  sun.awt.X11FontManager.getFontPath(Z)Ljava/lang/String;+0
j  sun.font.SunFontManager.getPlatformFontPath(Z)Ljava/lang/String;+10
j  sun.font.SunFontManager$10.run()Ljava/lang/Object;+21
v  ~StubRoutines::call_stub
V  [libjvm.so+0x3846c7]
V  [libjvm.so+0x50cf29]
V  [libjvm.so+0x3835cf]
V  [libjvm.so+0x3d955e]
C  [libjava.so+0xb3eb]  Java_java_security_AccessController_doPrivileged__Ljava_security_PrivilegedAction_2+0x3b
j  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object;+0
j  sun.font.SunFontManager.loadFonts()V+43
j  sun.awt.X11FontManager.loadFonts()V+1
j  sun.font.SunFontManager.findFont2D(Ljava/lang/String;II)Lsun/font/Font2D;+871
j  java.awt.Font.getFont2D()Lsun/font/Font2D;+86
j  java.awt.Font.access$000(Ljava/awt/Font;)Lsun/font/Font2D;+1
j  java.awt.Font$FontAccessImpl.getFont2D(Ljava/awt/Font;)Lsun/font/Font2D;+1
j  sun.font.FontUtilities.getFont2D(Ljava/awt/Font;)Lsun/font/Font2D;+4
j  sun.font.StandardGlyphVector.initFontData()V+5
j  sun.font.StandardGlyphVector.init(Ljava/awt/Font;[CIILjava/awt/font/FontRenderContext;I)V+84
j  sun.font.StandardGlyphVector.<init>(Ljava/awt/Font;Ljava/lang/String;Ljava/awt/font/FontRenderContext;)V+17
j  java.awt.Font.createGlyphVector(Ljava/awt/font/FontRenderContext;Ljava/lang/String;)Ljava/awt/font/GlyphVector;+7
...
Reproducible since JDK 7 b74.

Comments
EVALUATION This would have been the better bug ID but since it was fixed as 6958221: java.awt.Font.getFamily() leads to JVM crash on Linux on JDK7 for "custom" fonts I'm obliged to close this out as as a duplicate.
13-01-2011

EVALUATION The observed crash happens when font manager code tries to get awt lock. The reason of the crash is that some components required for AWT_LOCK macro are not initialized in jdk7. Namely, the macro preforms an call for a static java method of toolkit class and expects that tkClass and awtLockMID are alread initialized. These fields are initialized on initialization of x11 graphics environment, so possible solution is to get an local graphics environment explicitly just to force awt lock machinery initialization. Please see suggested fix in the corresponding section. Note that such kind of crash may happen only when graphics environment is not initialized: it can explain why we observe such crashes only on small tests which operates directly with fonts. Any GUI application seems to be immune to the problem.
27-10-2010

SUGGESTED FIX diff --git a/make/sun/xawt/mapfile-vers b/make/sun/xawt/mapfile-vers --- a/make/sun/xawt/mapfile-vers +++ b/make/sun/xawt/mapfile-vers @@ -188,7 +188,7 @@ SUNWprivate_1.1 { Java_sun_font_FontConfigManager_getFontConfig; Java_sun_font_FontConfigManager_getFontConfigAASettings; Java_sun_font_FontConfigManager_getFontConfigVersion; - Java_sun_awt_X11FontManager_getFontPath; + Java_sun_awt_X11FontManager_getFontPathNative; Java_sun_font_X11FontManager_setNativeFontPath; Java_sun_awt_X11GraphicsEnvironment_initDisplay; Java_sun_awt_X11GraphicsEnvironment_initGLX; diff --git a/src/solaris/classes/sun/awt/X11FontManager.java b/src/solaris/classes/sun/awt/X11FontManager.java --- a/src/solaris/classes/sun/awt/X11FontManager.java +++ b/src/solaris/classes/sun/awt/X11FontManager.java @@ -780,7 +780,13 @@ public class X11FontManager extends SunF preferLocaleFonts, preferPropFonts); } - public synchronized native String getFontPath(boolean noType1Fonts); + public synchronized String getFontPath(boolean noType1Fonts) { + GraphicsEnvironment ge = + GraphicsEnvironment.getLocalGraphicsEnvironment(); + return getFontPathNative(noType1Fonts); + } + + private native String getFontPathNative(boolean noType1Fonts); public String[] getDefaultPlatformFont() { if (defaultPlatformFont != null) { diff --git a/src/solaris/native/sun/awt/fontpath.c b/src/solaris/native/sun/awt/fontpath.c --- a/src/solaris/native/sun/awt/fontpath.c +++ b/src/solaris/native/sun/awt/fontpath.c @@ -527,7 +527,7 @@ static char *getPlatformFontPathChars(JN return path; } -JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPath +JNIEXPORT jstring JNICALL Java_sun_awt_X11FontManager_getFontPathNative (JNIEnv *env, jobject thiz, jboolean noType1) { jstring ret; static char *ptr = NULL; /* retain result across calls */
27-10-2010