1

I am writing a web app, which has a feature that writes data to an Excel file (using Apache POI tools) and gets downloaded by customers. The app runs pretty well on my Linux VM, but crashes on k8s each time a download request gets called.

Below is part of the JVM crash log:

#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f808e739294, pid=1, tid=0x00007f7fe52a4700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_241-b07) (build 1.8.0_241-b07)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.241-b07 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libc.so.6+0x10b294]  __clock_gettime+0x24
#
# Core dump written. Default location: /apply/integrator/core or core.1
#
# If you would like to submit a bug report, please visit:
#   http://bugreport.java.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
---------------  T H R E A D  ---------------

Current thread (0x00007f8088aa4800):  JavaThread "http-nio-8080-exec-6" daemon [_thread_in_native, id=74, stack(0x00007f7fe51a4000,0x00007f7fe52a5000)]

siginfo: si_signo: 11 (SIGSEGV), si_code: 128 (SI_KERNEL), si_addr: 0x0000000000000000
.......
.......
Stack: [0x00007f7fe51a4000,0x00007f7fe52a5000],  sp=0x00007f7fe529dc20,  free space=999k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x10b294]  __clock_gettime+0x24
C  [libc.so.6+0x86a63]
[error occurred during error reporting (printing native stack), id 0xb]

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
j  sun.font.FontConfigManager.initFontConfigFonts(Z)V+178
j  sun.font.FontConfigManager.loadFontConfig()[Lsun/font/FontConfigManager$FcCompFont;+2
j  sun.font.FcFontConfiguration.init()Z+39
j  sun.font.FcFontConfiguration.<init>(Lsun/font/SunFontManager;)V+16
j  sun.awt.X11FontManager.createFontConfiguration()Lsun/awt/FontConfiguration;+53
j  sun.font.SunFontManager$2.run()Ljava/lang/Object;+205
v  ~StubRoutines::call_stub
J 1599  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object; (0 bytes) @ 0x00007f80794d50cf [0x00007f80794d5080+0x4f]
j  sun.font.SunFontManager.<init>()V+222
j  sun.awt.FcFontManager.<init>()V+1
j  sun.awt.X11FontManager.<init>()V+1
v  ~StubRoutines::call_stub
J 1975  sun.reflect.NativeConstructorAccessorImpl.newInstance0(Ljava/lang/reflect/Constructor;[Ljava/lang/Object;)Ljava/lang/Object; (0 bytes) @ 0x00007f8079603fa3 [0x00007f8079603f40+0x63]
J 1974 C1 sun.reflect.NativeConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; (89 bytes) @ 0x00007f807960af7c [0x00007f8079609f40+0x103c]
J 2102 C1 sun.reflect.DelegatingConstructorAccessorImpl.newInstance([Ljava/lang/Object;)Ljava/lang/Object; (9 bytes) @ 0x00007f8079671ac4 [0x00007f80796719c0+0x104]
j  java.lang.reflect.Constructor.newInstance([Ljava/lang/Object;)Ljava/lang/Object;+79
J 4231 C1 java.lang.Class.newInstance()Ljava/lang/Object; (155 bytes) @ 0x00007f80791bf8ec [0x00007f80791befe0+0x90c]
j  sun.font.FontManagerFactory$1.run()Ljava/lang/Object;+21
v  ~StubRoutines::call_stub
J 1599  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedAction;)Ljava/lang/Object; (0 bytes) @ 0x00007f80794d50cf [0x00007f80794d5080+0x4f]
j  sun.font.FontManagerFactory.getInstance()Lsun/font/FontManager;+17
j  java.awt.Font.getFont2D()Lsun/font/Font2D;+0
j  java.awt.Font.canDisplayUpTo([CII)I+1
j  java.awt.font.TextLayout.singleFont([CIILjava/util/Map;)Ljava/awt/Font;+64
j  java.awt.font.TextLayout.<init>(Ljava/text/AttributedCharacterIterator;Ljava/awt/font/FontRenderContext;)V+170
j  org.apache.
.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+49
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(Ljava/lang/String;)Lorg/apache/poi/xssf/streaming/SXSSFSheet;+9
j  org.apache.poi.xssf.streaming.SXSSFWorkbook.createSheet(Ljava/lang/String;)Lorg/apache/poi/ss/usermodel/Sheet;+2
.......
.......
---------------  S Y S T E M  ---------------

OS:NAME="Alpine Linux"
ID=alpine
VERSION_ID=3.13.5
PRETTY_NAME="Alpine Linux v3.13"
HOME_URL="https://alpinelinux.org/"
BUG_REPORT_URL="https://bugs.alpinelinux.org/"

uname:Linux 5.10.113-1.el7.x86_64 #1 SMP Thu Apr 28 00:44:36 UTC 2022 x86_64
libc:glibc 2.30 NPTL 2.30 
rlimit: STACK 8192k, CORE infinity, NPROC infinity, NOFILE 1048576, AS infinity
load average:2.42 2.39 2.38

/proc/meminfo:
MemTotal:       65960156 kB
MemFree:        50173428 kB
MemAvailable:   56264880 kB
Buffers:          199864 kB
Cached:          6194120 kB
SwapCached:            0 kB
Active:          1624812 kB
Inactive:       12835352 kB
Active(anon):     136984 kB
Inactive(anon):  8153056 kB
Active(file):    1487828 kB
Inactive(file):  4682296 kB
Unevictable:           0 kB
Mlocked:               0 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:               484 kB
Writeback:             0 kB
AnonPages:       7918388 kB
Mapped:           454332 kB
Shmem:            315468 kB
KReclaimable:     658012 kB
Slab:             928020 kB
SReclaimable:     658012 kB
SUnreclaim:       270008 kB
KernelStack:       39840 kB
PageTables:        36932 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:    32980076 kB
Committed_AS:   12516988 kB
VmallocTotal:   34359738367 kB
VmallocUsed:      162160 kB
VmallocChunk:          0 kB
Percpu:            71936 kB
HardwareCorrupted:     0 kB
AnonHugePages:   6258688 kB
ShmemHugePages:        0 kB
ShmemPmdMapped:        0 kB
FileHugePages:         0 kB
FilePmdMapped:         0 kB
HugePages_Total:       0
HugePages_Free:        0
HugePages_Rsvd:        0
HugePages_Surp:        0
Hugepagesize:       2048 kB
Hugetlb:               0 kB
DirectMap4k:      431996 kB
DirectMap2M:    66676736 kB

The key point appears to be:

# The crash happened outside the Java Virtual Machine in native code.
# Problematic frame:
# C  [libc.so.6+0x10b294]  __clock_gettime+0x24

...which is beyond my abilities to fix. How would I resolve this issue?

Chris Forrence
  • 10,042
  • 11
  • 48
  • 64
ayumi
  • 11
  • 2
  • 1
    Seems the crash is only indirect triggered by Apache POI. The `org.apache.poi.xssf.streaming.AutoSizeColumnTracker` needs to know the default character width. The `org.apache.ss.util.SheetUtil.getDefaultCharWidth` tries to get that from `java.awt.font.TextLayout` and that crashes while trying to get `sun.font.FontConfigManager.getFontConfig`. I don't know k8s. But question is, is k8s even able to get a font config? Has it access to the font configuration files? – Axel Richter Jul 22 '22 at 06:33
  • We use Apache POI quite happily on k8s, including `Sheet.autoSizeColumn`. Make sure your Docker base image includes some fonts, ubuntu based ones normally do, stripped down alpine ones may not. No fonts -> can't render text -> can't auto-calculate column sizes – Gagravarr Jul 22 '22 at 08:19
  • 1
    upgrade your java runtime - even to the latest 8.0.x version - the SIGSEGV issue in the java runtime could be fixed in a newer version – PJ Fanning Jul 22 '22 at 10:28

0 Answers0