在尝试使用 Jmagick 将图像转换为 jpg 格式时,JVM 崩溃了,这是报告。任何建议如何弄清楚我们如何解决 Jmagick 的问题或任何解决此问题的方法。
JVM 崩溃报告
#
# A fatal error has been detected by the Java Runtime Environment:
#
# SIGBUS (0x7) at pc=0x00007f204d9987f8, pid=7107, tid=139775491942144
#
# JRE version: Java(TM) SE Runtime Environment (7.0_45-b18) (build 1.7.0_45-b18)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (24.45-b08 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C [libc.so.6+0x1287f8] __nss_hosts_lookup+0x16848
#
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#
# If you would like to submit a bug report, please visit:
# http://bugreport.sun.com/bugreport/crash.jsp
# The crash happened outside the Java Virtual Machine in native code.
# See problematic frame for where to report the bug.
#
- - - - - - - - 线 - - - - - - - -
Current thread (0x00007f2010140000): JavaThread "MEDIASERVICE-TRANSCODING-EXECUTOR-5" daemon [_thread_in_native, id=7614, stack(0x00007f20047ba000,0x00007f20048bb000)]
siginfo:si_signo=SIGBUS: si_errno=0, si_code=2 (BUS_ADRERR), si_addr=0x00007f2025303000
寄存器:
RAX=0x00000000028dacd8, RBX=0x00000000058d8a10, RCX=0x0000000000008000, RDX=0x00000000000007f5
RSP=0x00007f20048b14d8, RBP=0x000000000000287d, RSI=0x00007f2025302f88, RDI=0x00000000028dcc60
R8 =0x00000000028dacd8, R9 =0x00007f204d9987d0, R10=0x00007f204dbf5eb0, R11=0x00007f204d9c4970
R12=0x00000000028dacd8, R13=0x0000000000000000, R14=0x0000000000000000, R15=0x0000000000000000
RIP=0x00007f204d9987f8, EFLAGS=0x0000000000010206, CSGSFS=0x0000000000000033, ERR=0x0000000000000004
TRAPNO=0x000000000000000e
栈顶:(sp=0x00007f20048b14d8)
0x00007f20048b14d8: 00007f2014205c05 0000000002e549d8
0x00007f20048b14e8: 00007f20048b1ee0 00000000031c3320
0x00007f20048b14f8: 00007f200cc6846f 0000000000000760
0x00007f20048b1508: 00007f20048b1ee0 0000000002e549d8
0x00007f20048b1518: 00007f200f68ef96 00007f204dbf5ec8
0x00007f20048b1528: 00007f20048b1ee0 00000000000053a0
0x00007f20048b1538: 0000007300000760 00000000000053d0
0x00007f20048b1548: 0000053b00000120 00000000020e4380
0x00007f20048b1558: 00007f20048b1ee0 0000000000000002
0x00007f20048b1568: 00000000031c3320 00007f20101200e0
0x00007f20048b1578: 000000000c2b3b98 000000000c2b6b98
0x00007f20048b1588: 00007f200f68c78d 00007f20048b1ee0
0x00007f20048b1598: 0000000000000001 00007f20048b1ee0
0x00007f20048b15a8: 00007f20101200e0 000000000c2b3b98
0x00007f20048b15b8: 00007f200f685577 0000000000000001
0x00007f20048b15c8: 0000000002e549c0 00007f20048b1ee0
0x00007f20048b15d8: 00007f200f68580b 0000000000000002
0x00007f20048b15e8: 00007f20048b1ee0 00007f20101200e0
0x00007f20048b15f8: 000000000000000f 0000000000000010
0x00007f20048b1608: 00007f200cc698ff 0000000100000001
0x00007f20048b1618: 00007f2000000001 00007f2000000001
0x00007f20048b1628: 00007f20048b1cc0 0000000000000010
0x00007f20048b1638: 00007f20048b1e78 00007f20048b1cd0
0x00007f20048b1648: 00007f204d8b3809 00007f1fbc87b938
0x00007f20048b1658: 0000000000000013 00000000058d8a10
0x00007f20048b1668: 000000000c2b3a50 00007f20048b92f0
0x00007f20048b1678: 00007f20048b1a10 00007f20048b1950
0x00007f20048b1688: 00007f20048b1a20 0000000000000014
0x00007f20048b1698: 0000000000000067 0000000000000020
0x00007f20048b16a8: 0000000000000067 00007f2044e300e0
0x00007f20048b16b8: 0000000000000000 0000000000000000
0x00007f20048b16c8: 0000000000000000 0000000000000000
说明:(pc=0x00007f204d9987f8)
0x00007f204d9987d8: 28 4e f8 0f 28 56 08 0f 28 5e 18 0f 28 66 28 0f
0x00007f204d9987e8: 28 6e 38 0f 28 76 48 0f 28 7e 58 44 0f 28 46 68
0x00007f204d9987f8: 44 0f 28 4e 78 48 8d b6 80 00 00 00 66 45 0f 3a
0x00007f204d998808: 0f c8 08 44 0f 29 4f 70 66 44 0f 3a 0f c7 08 44
注册到内存映射:
RAX=0x00000000028dacd8 is an unknown value
RBX=0x00000000058d8a10 is an unknown value
RCX=0x0000000000008000 is an unknown value
RDX=0x00000000000007f5 is an unknown value
RSP=0x00007f20048b14d8 is pointing into the stack for thread: 0x00007f2010140000
RBP=0x000000000000287d is an unknown value
RSI=0x00007f2025302f88 is an unknown value
RDI=0x00000000028dcc60 is an unknown value
R8 =0x00000000028dacd8 is an unknown value
R9 =0x00007f204d9987d0: <offset 0x1287d0> in /lib/x86_64-linux-gnu/libc.so.6 at 0x00007f204d870000
R10=0x00007f204dbf5eb0: <offset 0x385eb0> in /lib/x86_64-linux-gnu/libc.so.6 at 0x00007f204d870000
R11=0x00007f204d9c4970: <offset 0x154970> in /lib/x86_64-linux-gnu/libc.so.6 at 0x00007f204d870000
R12=0x00000000028dacd8 is an unknown value
R13=0x0000000000000000 is an unknown value
R14=0x0000000000000000 is an unknown value
R15=0x0000000000000000 is an unknown value
堆:
[0x00007f20047ba000,0x00007f20048bb000], sp=0x00007f20048b14d8, free space=989k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C [libc.so.6+0x1287f8] __nss_hosts_lookup+0x16848
Java 框架:
(J=compiled Java code, j=interpreted, Vv=VM code)
j magick.MagickImage.readImage(Lmagick/ImageInfo;)V+0
j magick.MagickImage.<init>(Lmagick/ImageInfo;)V+11
j com.app.mediaservice.transcoding.task.image.ImageTranscodeTask.doTranscode(Ljava/io/File;Ljava/io/File;Ljavax/activation/MimeType;Lcom/app/mediaservice/MediaObjectType;)[B+48
j com.app.mediaservice.transcoding.task.TranscodeCallable.call()Lcom/app/mediaservice/MediaObjectRendition;+69
j com.app.mediaservice.transcoding.task.TranscodeCallable.call()Ljava/lang/Object;+1
j java.util.concurrent.FutureTask.run()V+42
J java.util.concurrent.ThreadPoolExecutor.runWorker(Ljava/util/concurrent/ThreadPoolExecutor$Worker;)V
j java.util.concurrent.ThreadPoolExecutor$Worker.run()V+5
j java.lang.Thread.run()V+11
v ~StubRoutines::call_stub
详细报告上传: http: //pastebin.com/XzFTUBtX
代码
File inputFile = <Some file copied to tmp folder>
ImageInfo info = new ImageInfo(inputFile.getAbsolutePath());
MagickImage magickImage = new MagickImage(info);
try {
magickImage = ImageThumbnail.createThumbnail(magickImage, targetMediaObjectType);
magickImage.setFileName(outputFile.getAbsolutePath());
magickImage.writeImage(info);
} catch (MagickException e) {
LOG.error(String.format("Transcoding of Image failed %s->%s", original.getMimeType(), targetType), e);
throw e;
} finally {
magickImage.destroyImages();
}
public static MagickImage createThumbnail(MagickImage magickImage, MediaObjectType targetMediaObjectType) throws MagickException {
magickImage.setImageFormat("JPEG");
magickImage.setQuality(50);
magickImage.profileImage("*", null);
switch (some logic) {
case crop:
magickImage = magickImage.scaleImage(newWidth, newHeiht);
Rectangle chopInfo = new Rectangle(0, 0, 50, 50);
magickImage = magickImage.cropImage(chopInfo);
break;
case resize:
magickImage = magickImage.scaleImage(newWidth, newHeight);
break;
}
return magickImage;
}