alpinelinux / docker-alpine

Official Alpine Linux Docker image. Win at minimalism!
MIT License
1.08k stars 262 forks source link

Critical Issue: JVM Crashes with Font Configuration Related Errors After Alpine 3.18.2 Update #331

Closed pasindudt closed 1 year ago

pasindudt commented 1 year ago

I wanted to bring to your attention a critical issue we've encountered after updating Alpine from version 3.17.2 to 3.18.2. It seems that this update has led to unexpected JVM crashes, particularly when working with certain libraries like Apache POI. It appears that the problem lies in the font configurations within the updated Alpine version.

We have installed additional fonts using the following command.

RUN apk add --update fontconfig ttf-dejavu --no-cache

Crash log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x0000000000001130, pid=120, tid=208
#
# JRE version: OpenJDK Runtime Environment Microsoft-7208460 (11.0.18+10) (build 11.0.18+10-LTS)
# Java VM: OpenJDK 64-Bit Server VM Microsoft-7208460 (11.0.18+10-LTS, mixed mode, tiered, compressed oops, g1 gc, linux-amd64)
# Problematic frame:
# C  0x0000000000001130
#
# Core dump will be written. Default location: /opt/appuser/wlp/output/defaultServer/core.120
#
# If you would like to submit a bug report, please visit:
#   https://github.com/microsoft/openjdk/issues
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#

---------------  S U M M A R Y ------------

Command Line: -javaagent:/opt/appuser/wlp/bin/tools/ws-javaagent.jar -Djava.awt.headless=true -Djdk.attach.allowAttachSelf=true -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:8888 -Dnashorn.args=--no-deprecation-warning -Dlog4j2.formatMsgNoLookups=true -Xmx800m -XX:+HeapDumpOnOutOfMemoryError -XX:HeapDumpPath=/opt/appuser/output/heapdump/heapdump.hprof -XX:+ExitOnOutOfMemoryError --add-exports=java.base/sun.security.action=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.ldap=ALL-UNNAMED --add-exports=java.naming/com.sun.jndi.url.ldap=ALL-UNNAMED --add-exports=java.security.jgss/sun.security.krb5.internal=ALL-UNNAMED --add-exports=jdk.attach/sun.tools.attach=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED --add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.util.concurrent=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.naming/javax.naming.spi=ALL-UNNAMED --add-opens=jdk.naming.rmi/com.sun.jndi.url.rmi=ALL-UNNAMED --add-opens=java.naming/javax.naming=ALL-UNNAMED --add-opens=java.rmi/java.rmi=ALL-UNNAMED --add-opens=java.sql/java.sql=ALL-UNNAMED --add-opens=java.management/javax.management=ALL-UNNAMED --add-opens=java.base/java.lang.reflect=ALL-UNNAMED --add-opens=java.desktop/java.awt.image=ALL-UNNAMED --add-opens=java.base/java.security=ALL-UNNAMED --add-opens=java.base/java.net=ALL-UNNAMED /opt/appuser/wlp/bin/tools/ws-server.jar defaultServer

Host: Intel(R) Xeon(R) Gold 6258R CPU @ 2.70GHz, 8 cores, 15G, Alpine Linux v3.18
Time: Wed Jul  5 03:09:54 2023 UTC elapsed time: 67.216850 seconds (0d 0h 1m 7s)

---------------  T H R E A D  ---------------

Current thread (0x00007fdda80a5800):  JavaThread "Default Executor-thread-15" daemon [_thread_in_native, id=208, stack(0x00007fdd8580a000,0x00007fdd8590b000)]

Stack: [0x00007fdd8580a000,0x00007fdd8590b000],  sp=0x00007fdd85903528,  free space=997k
Native frames: (J=compiled Java code, A=aot compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  0x0000000000001130

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j  sun.font.FontConfigManager.getFontConfig(Ljava/lang/String;Lsun/font/FontConfigManager$FontConfigInfo;[Lsun/font/FontConfigManager$FcCompFont;Z)V+0 java.desktop@11.0.18
j  sun.font.FontConfigManager.initFontConfigFonts(Z)V+178 java.desktop@11.0.18
j  sun.font.FontConfigManager.loadFontConfig()[Lsun/font/FontConfigManager$FcCompFont;+2 java.desktop@11.0.18
j  sun.font.FcFontConfiguration.init()Z+39 java.desktop@11.0.18
j  sun.font.FcFontConfiguration.<init>(Lsun/font/SunFontManager;)V+16 java.desktop@11.0.18
j  sun.awt.X11FontManager.createFontConfiguration()Lsun/awt/FontConfiguration;+40 java.desktop@11.0.18
j  sun.font.SunFontManager$2.run()Ljava/lang/Object;+175 java.desktop@11.0.18
v  ~StubRoutines::call_stub
J 1114  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object; java.base@11.0.18 (0 bytes) @ 0x00007fde359b930f [0x00007fde359b92c0+0x000000000000004f]
j  sun.font.SunFontManager.<init>()V+223 java.desktop@11.0.18
j  sun.awt.FcFontManager.<init>()V+1 java.desktop@11.0.18
j  sun.awt.X11FontManager.<init>()V+1 java.desktop@11.0.18
v  ~StubRoutines::call_stub
J 5241  jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance0(Ljava/lang/reflect/Constructor;[Ljava/lang/Object;)Ljava/lang/Object; java.base@11.0.18 (0 bytes) @ 0x00007fde35c20723 [0x00007fde35c206c0+0x0000000000000063]
J 11996 c1 jdk.internal.reflect.NativeConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; java.base@11.0.18 (89 bytes) @ 0x00007fde2e7597e4 [0x00007fde2e758c40+0x0000000000000ba4]
J 10233 c2 jdk.internal.reflect.DelegatingConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; java.base@11.0.18 (9 bytes) @ 0x00007fde36230b6c [0x00007fde36230b20+0x000000000000004c]
J 15337 c1 java.lang.reflect.Constructor.newInstance([Ljava/lang/Object;)Ljava/lang/Object; java.base@11.0.18 (76 bytes) @ 0x00007fde2e662614 [0x00007fde2e6623a0+0x0000000000000274]
j  sun.font.FontManagerFactory$1.run()Ljava/lang/Object;+32 java.desktop@11.0.18
v  ~StubRoutines::call_stub
J 1114  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object; java.base@11.0.18 (0 bytes) @ 0x00007fde359b930f [0x00007fde359b92c0+0x000000000000004f]
j  sun.font.FontManagerFactory.getInstance()Lsun/font/FontManager;+17 java.desktop@11.0.18
j  java.awt.Font.getFont2D()Lsun/font/Font2D;+0 java.desktop@11.0.18
j  java.awt.Font.canDisplayUpTo([CII)I+1 java.desktop@11.0.18
j  java.awt.font.TextLayout.singleFont([CIILjava/util/Map;)Ljava/awt/Font;+64 java.desktop@11.0.18
j  java.awt.font.TextLayout.<init>(Ljava/text/AttributedCharacterIterator;Ljava/awt/font/FontRenderContext;)V+170 java.desktop@11.0.18
j  org.apache.poi.ss.util.SheetUtil.getDefaultCharWidth(Lorg/apache/poi/ss/usermodel/Workbook;)I+39
j  org.apache.poi.xssf.streaming.AutoSizeColumnTracker.<init>(Lorg/apache/poi/ss/usermodel/Sheet;)V+44
j  org.apache.poi.xssf.streaming.SXSSFSheet.<init>(Lorg/apache/poi/xssf/streaming/SXSSFWorkbook;Lorg/apache/poi/xssf/usermodel/XSSFSheet;)V+71
j  org.apache.poi.xssf.streaming.SXSSFWorkbook.createAndRegisterSXSSFSheet(Lorg/apache/poi/xssf/usermodel/XSSFSheet;)Lorg/apache/poi/xssf/streaming/SXSSFSheet;+6
j  org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet()Lorg/apache/poi/xssf/streaming/SXSSFSheet;+8
j 

Please let us know if you require any additional information or logs to investigate the problem further.

westwind-sc commented 1 year ago

ttf-dejavu not exist in 3.17 and 3.18 But exists in 3.16 So the font is missing in the image

Please try font-dejavu in 3.18

pasindudt commented 1 year ago

@westwind-sc I have tried with font-dejavu. Still no luck. It seems this is not related to a specific font type. We got same error for another application. That application uses different fonts.

RUN apk --no-cache add msttcorefonts-installer fontconfig freetype && \
    update-ms-fonts && \
    fc-cache -f
westwind-sc commented 1 year ago

Could you share the Dockerfile and step to reproduce it?

pasindudt commented 1 year ago

It seems issue was due an incompatible java version. Resolved by moving java to microsoft-jdk-11.0.18-alpine-x64.tar.gz.

@westwind-sc Thanks for your time.