JVM crashes at frame libfreetype.so or libt2k.so
Environment
- JBoss Enterprise Application Platform (EAP)
- 6.x
- 7.x
- OpenJDK
- Java 8
- Java 11
Issue
- JVM crash with problematic frame
libfreetype.soorlibt2k.soin crash log - JVM crashes in method
sun.font.*.getGlyph*Native - While creating jasperreports within the application, JVM process gets killed with crash file
hs_err_pidxxxx.log
Resolution
- The crash happens during the report generation in
libfreetype.solibrary insun.font.FreetypeFontScaler.getGlyphImageNativeorsun.font.FreetypeFontScaler.getGlyphOutlineNativemethod. - This issue is seen if the JVM's tmp files are removed while it is running causing it to crash when the temporary files are not available.
- Set Java option
-Djava.io.tmpdir=/path/to/tmpdirto a custom location to change temporary font files being created in /tmp . - Also check if
*JF*.tmpor*JXF*.tmpfiles are removed by a script or manually while JVM is running.
Root Cause
- The JVM holds the same address of the font files while the process is running.
- Removing the font while the JVM is running results in crashing when the fonts are requested for use by the application.
Diagnostic Steps
- Check if any scripts are cleaning out files from a directory where
java.io.tmpdirpoints to. - Verify that the font files corresponding to the application module are present in
java.io.tmpdiror the configured directory. - Check JVM crash file
hs_err_pidxxxx.logfor frame and thread where the crash occurred. - Stack trace should confirm the issue occurrence at
sun.font.FreetypeFontScaler.getGlyphImageNative.
# Problematic frame:
# C [libfreetype.so.6+0x2bd66]
#
Current thread (0x00000000073f3000): JavaThread "default task-43" [_thread_in_native, id=4153, stack(0x00007f62b8c08000,0x00007f62b8d09000)]
Stack: [0x00007f62b8c08000,0x00007f62b8d09000], sp=0x00007f62b8d03000, free space=1004k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libfreetype.so.6+0x2bd66]
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j sun.font.FreetypeFontScaler.getGlyphImageNative(Lsun/font/Font2D;JJI)J+0
j sun.font.FreetypeFontScaler.getGlyphImage(JI)J+26
J 45218 C1 sun.font.FileFontStrike.getGlyphImagePtr(I)J (126 bytes) @ 0x00007f631b604e9c [0x00007f631b6037c0+0x16dc]
J 54248 C1 sun.font.FileFontStrike.getGlyphMetrics(IZ)Ljava/awt/geom/Point2D$Float; (277 bytes) @ 0x00007f631b4f2c5c [0x00007f631b4f2960+0x2fc]
J 58449 C1 sun.font.FileFontStrike.getGlyphMetrics(I)Ljava/awt/geom/Point2D$Float; (7 bytes) @ 0x00007f63150a2cc4 [0x00007f63150a2c40+0x84]
v ~StubRoutines::call_stub
j sun.font.SunLayoutEngine.nativeLayout(Lsun/font/Font2D;Lsun/font/FontStrike;[FII[CIIIIIIILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;JJ)V+0
j sun.font.SunLayoutEngine.layout(Lsun/font/FontStrikeDesc;[FIILsun/font/TextRecord;ILjava/awt/geom/Point2D$Float;Lsun/font/GlyphLayout$GVData;)V+105
j sun.font.GlyphLayout$EngineRecord.layout()V+95
j sun.font.GlyphLayout.layout(Ljava/awt/Font;Ljava/awt/font/FontRenderContext;[CIIILsun/font/StandardGlyphVector;)Lsun/font/StandardGlyphVector;+561
j sun.font.ExtendedTextSourceLabel.createGV()Lsun/font/StandardGlyphVector;+63
j sun.font.ExtendedTextSourceLabel.getGV()Lsun/font/StandardGlyphVector;+9
j sun.font.ExtendedTextSourceLabel.createCharinfo()[F+1
j sun.font.ExtendedTextSourceLabel.getCharinfo()[F+9
j sun.font.ExtendedTextSourceLabel.getLineBreakIndex(IF)I+1
j java.awt.font.TextMeasurer.calcLineBreak(IF)I+96
j java.awt.font.TextMeasurer.getLineBreakIndex(IF)I+38
j java.awt.font.LineBreakMeasurer.nextOffset(FIZ)I+44
j net.sf.jasperreports.engine.fill.SimpleTextLineWrapper.measureExactLineBreakIndex(FIZ)I+110
Product(s)
Components
Category
Tags
This solution is part of Red Hat’s fast-track publication program, providing a huge library of solutions that Red Hat engineers have created while supporting our customers. To give you the knowledge you need the instant it becomes available, these articles may be presented in a raw and unedited form.