Hi,
I have encountered an issue where occasionally, the JVM crashes when trying to read a JPG image. This does not occur all the time when uploading the same image.
I am running a Java web application on Tomcat, which allows users to upload images which we save.
My Java code is reading the image as follows
myImagesInputStream = new ByteArrayInputStream(originalFileInBytes);
BufferedImage bufferedImage = ImageIO.read(
myImagesInputStream
);
On occasion, the JVM crashes and I get the following error logged, which indicates a problem with libclib_jiio.so+0x74dfc] jpeg_read_markers+0xf8c
I am using the linux-x86_64 version of the libclib_jiio.so library in
dcm4che 5.22.6.
Has anyone encountered this issue before?
Thanks,
Kevin.
15-Apr-2021 17:19:32.416 INFO [http-nio-8080-exec-20] org.opencv.osgi.OpenCVNativeLoader.init Successfully loaded OpenCV native library.
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGSEGV (0xb) at pc=0x00007f7cc2986dfc, pid=12977, tid=0x00007f7cc4d41700
#
# JRE version: OpenJDK Runtime Environment (8.0_265-b01) (build 1.8.0_265-b01)
# Java VM: OpenJDK 64-Bit Server VM (25.265-b01 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libclib_jiio.so+0x74dfc] jpeg_read_markers+0xf8c
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# An error report file with more information is saved as:
# /tmp/hs_err_pid12977.log
#
# 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.
#
The hs_err_pid.log file created details the following :
Stack: [0x00007f7cc4c41000,0x00007f7cc4d42000], sp=0x00007f7cc4d3c040, free space=1004k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libclib_jiio.so+0x74dfc] jpeg_read_markers+0xf8c
Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
j com.sun.medialib.codec.jpeg.Decoder.njpeg_decode(J[I)V+0
j com.sun.medialib.codec.jpeg.Decoder.decode(Lcom/sun/medialib/codec/jiio/mediaLibImage;)Lcom/sun/medialib/codec/jiio/mediaLibImage;+20
j com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReader.decode(Ljava/io/InputStream;)Lcom/sun/medialib/codec/jiio/mediaLibImage;+44
j com.sun.media.imageioimpl.plugins.clib.CLibImageReader.getImage(I)Lcom/sun/medialib/codec/jiio/mediaLibImage;+82
j com.sun.media.imageioimpl.plugins.clib.CLibImageReader.read(ILjavax/imageio/ImageReadParam;)Ljava/awt/image/BufferedImage;+37
j javax.imageio.ImageIO.read(Ljavax/imageio/stream/ImageInputStream;)Ljava/awt/image/BufferedImage;+55
j javax.imageio.ImageIO.read(Ljava/io/InputStream;)Ljava/awt/image/BufferedImage;+34
j com.my.service.theservice.MyServiceImpl.createImage(Lorg/springframework/web/multipart/MultipartFile;Lmy/service/jdbc/dao/model/abc;JJILjava/lang/String;Ljava/lang/String;Ljava/lang/String;J)J+1828
v ~StubRoutines::call_stub