jvm崩溃并输出 hs_err_pidxxxx.log文件异常原因

今天在服务其上面部署一个已经存在得jar包可执行文件时,猛然发现在jar得同级目录下居然存在多个 hs_err_pidxxxx.log文件,查看该文件,里面内容如下
#
# A fatal error has been detected by the Java Runtime Environment:
#
#  SIGSEGV (0xb) at pc=0x00007f5a7617ce38, pid=5920, tid=0x00007f5a37cfc700
#
# JRE version: Java(TM) SE Runtime Environment (8.0_221-b11) (build 1.8.0_221-b11)
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.221-b11 mixed mode linux-amd64 compressed oops)
# Problematic frame:
# C  [libc.so.6+0x14ee38]  __memmove_ssse3_back+0x648
#
# 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.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.

通过上面的异常信息发现是本地方法报错

异常文件中的异常发生时栈信息如下:

Stack: [0x00007f5a37bfc000,0x00007f5a37cfd000],  sp=0x00007f5a37cf9518,  free space=1013k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
C  [libc.so.6+0x14ee38]  __memmove_ssse3_back+0x648
C  [libzip.so+0x129fe]  ZIP_GetEntry2+0xde
C  [libzip.so+0x3a75]  Java_java_util_zip_ZipFile_getEntry+0x85
J 302  java.util.zip.ZipFile.getEntry(J[BZ)J (0 bytes) @ 0x00007f5a611a418e [0x00007f5a611a40c0+0xce]
J 373 C1 java.util.zip.ZipFile.getEntry(Ljava/lang/String;)Ljava/util/zip/ZipEntry; (101 bytes) @ 0x00007f5a611d8df9 [0x00007f5a611d8ba0+0x259]
J 372 C1 java.util.jar.JarFile.getEntry(Ljava/lang/String;)Ljava/util/zip/ZipEntry; (22 bytes) @ 0x00007f5a611d96e3 [0x00007f5a611d9660+0x83]
J 1991 C1 sun.misc.URLClassPath$JarLoader.getResource(Ljava/lang/String;Z)Lsun/misc/Resource; (85 bytes) @ 0x00007f5a615f0138 [0x00007f5a615f0060+0xd8]
j  sun.misc.URLClassPath.getResource(Ljava/lang/String;Z)Lsun/misc/Resource;+62
J 310 C1 java.net.URLClassLoader$1.run()Ljava/lang/Class; (63 bytes) @ 0x00007f5a611ac455 [0x00007f5a611ac260+0x1f5]
J 2187 C1 java.net.URLClassLoader$1.run()Ljava/lang/Object; (5 bytes) @ 0x00007f5a616a8ef8 [0x00007f5a616a8e80+0x78]
v  ~StubRoutines::call_stub
V  [libjvm.so+0x68842b]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0xddb
V  [libjvm.so+0x700674]  JVM_DoPrivileged+0x4f4
J 278  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object; (0 bytes) @ 0x00007f5a6118fd15 [0x00007f5a6118fc40+0xd5]
J 1518 C2 java.lang.ClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class; (122 bytes) @ 0x00007f5a614b7068 [0x00007f5a614b6560+0xb08]
J 227 C1 sun.misc.Launcher$AppClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class; (85 bytes) @ 0x00007f5a611818b7 [0x00007f5a61180f40+0x977]
J 294 C1 java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class; (7 bytes) @ 0x00007f5a6119bf42 [0x00007f5a6119be40+0x102]
v  ~StubRoutines::call_stub
V  [libjvm.so+0x68842b]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0xddb
V  [libjvm.so+0x685cf3]  JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x263
V  [libjvm.so+0x686313]  JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Handle, Thread*)+0x53
V  [libjvm.so+0xa44e04]  SystemDictionary::load_instance_class(Symbol*, Handle, Thread*)+0x2e4
V  [libjvm.so+0xa437cb]  SystemDictionary::resolve_instance_class_or_null(Symbol*, Handle, Handle, Thread*)+0x87b
V  [libjvm.so+0xa456a9]  SystemDictionary::resolve_or_fail(Symbol*, Handle, Handle, bool, Thread*)+0x49
V  [libjvm.so+0x4cfc07]  ConstantPool::klass_at_impl(constantPoolHandle, int, Thread*)+0x187
V  [libjvm.so+0x675a43]  InterpreterRuntime::_new(JavaThread*, ConstantPool*, int)+0xa3
j  ch.qos.logback.classic.spi.LoggingEvent.<init>(Ljava/lang/String;Lch/qos/logback/classic/Logger;Lch/qos/logback/classic/Level;Ljava/lang/String;Ljava/lang/Throwable;[Ljava/lang/Object;)V+72
j  ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Ljava/lang/String;Lorg/slf4j/Marker;Lch/qos/logback/classic/Level;Ljava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V+13
j  ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Ljava/lang/String;Lorg/slf4j/Marker;Lch/qos/logback/classic/Level;Ljava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V+57
j  ch.qos.logback.classic.Logger.error(Lorg/slf4j/Marker;Ljava/lang/String;Ljava/lang/Throwable;)V+11
j  org.apache.ignite.logger.slf4j.Slf4jLogger.error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V+11
j  org.apache.ignite.logger.slf4j.Slf4jLogger.error(Ljava/lang/String;Ljava/lang/Throwable;)V+4
j  org.apache.ignite.internal.GridLoggerProxy.error(Ljava/lang/String;Ljava/lang/Throwable;)V+10
j  org.apache.ignite.internal.util.IgniteUtils.error(Lorg/apache/ignite/IgniteLogger;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Throwable;)V+69
j  org.apache.ignite.internal.util.IgniteUtils.error(Lorg/apache/ignite/IgniteLogger;Ljava/lang/Object;Ljava/lang/Throwable;)V+27
j  org.apache.ignite.spi.IgniteSpiThread.run()V+258
v  ~StubRoutines::call_stub
V  [libjvm.so+0x68842b]  JavaCalls::call_helper(JavaValue*, methodHandle*, JavaCallArguments*, Thread*)+0xddb
V  [libjvm.so+0x685cf3]  JavaCalls::call_virtual(JavaValue*, KlassHandle, Symbol*, Symbol*, JavaCallArguments*, Thread*)+0x263
V  [libjvm.so+0x6862b7]  JavaCalls::call_virtual(JavaValue*, Handle, KlassHandle, Symbol*, Symbol*, Thread*)+0x47
V  [libjvm.so+0x6f242c]  thread_entry(JavaThread*, Thread*)+0x6c
V  [libjvm.so+0xa7ba9b]  JavaThread::thread_main_inner()+0xdb
V  [libjvm.so+0xa7bda1]  JavaThread::run()+0x2d1
V  [libjvm.so+0x90d952]  java_start(Thread*)+0x102
C  [libpthread.so.0+0x7dc5]  start_thread+0xc5

Java frames: (J=compiled Java code, j=interpreted, Vv=VM code)
J 302  java.util.zip.ZipFile.getEntry(J[BZ)J (0 bytes) @ 0x00007f5a611a4118 [0x00007f5a611a40c0+0x58]
J 373 C1 java.util.zip.ZipFile.getEntry(Ljava/lang/String;)Ljava/util/zip/ZipEntry; (101 bytes) @ 0x00007f5a611d8df9 [0x00007f5a611d8ba0+0x259]
J 372 C1 java.util.jar.JarFile.getEntry(Ljava/lang/String;)Ljava/util/zip/ZipEntry; (22 bytes) @ 0x00007f5a611d96e3 [0x00007f5a611d9660+0x83]
J 1991 C1 sun.misc.URLClassPath$JarLoader.getResource(Ljava/lang/String;Z)Lsun/misc/Resource; (85 bytes) @ 0x00007f5a615f0138 [0x00007f5a615f0060+0xd8]
j  sun.misc.URLClassPath.getResource(Ljava/lang/String;Z)Lsun/misc/Resource;+62
J 310 C1 java.net.URLClassLoader$1.run()Ljava/lang/Class; (63 bytes) @ 0x00007f5a611ac455 [0x00007f5a611ac260+0x1f5]
J 2187 C1 java.net.URLClassLoader$1.run()Ljava/lang/Object; (5 bytes) @ 0x00007f5a616a8ef8 [0x00007f5a616a8e80+0x78]
v  ~StubRoutines::call_stub
J 278  java.security.AccessController.doPrivileged(Ljava/security/PrivilegedExceptionAction;Ljava/security/AccessControlContext;)Ljava/lang/Object; (0 bytes) @ 0x00007f5a6118fca3 [0x00007f5a6118fc40+0x63]
J 1518 C2 java.lang.ClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class; (122 bytes) @ 0x00007f5a614b7068 [0x00007f5a614b6560+0xb08]
J 227 C1 sun.misc.Launcher$AppClassLoader.loadClass(Ljava/lang/String;Z)Ljava/lang/Class; (85 bytes) @ 0x00007f5a611818b7 [0x00007f5a61180f40+0x977]
J 294 C1 java.lang.ClassLoader.loadClass(Ljava/lang/String;)Ljava/lang/Class; (7 bytes) @ 0x00007f5a6119bf42 [0x00007f5a6119be40+0x102]
v  ~StubRoutines::call_stub
j  ch.qos.logback.classic.spi.LoggingEvent.<init>(Ljava/lang/String;Lch/qos/logback/classic/Logger;Lch/qos/logback/classic/Level;Ljava/lang/String;Ljava/lang/Throwable;[Ljava/lang/Object;)V+72
j  ch.qos.logback.classic.Logger.buildLoggingEventAndAppend(Ljava/lang/String;Lorg/slf4j/Marker;Lch/qos/logback/classic/Level;Ljava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V+13
j  ch.qos.logback.classic.Logger.filterAndLog_0_Or3Plus(Ljava/lang/String;Lorg/slf4j/Marker;Lch/qos/logback/classic/Level;Ljava/lang/String;[Ljava/lang/Object;Ljava/lang/Throwable;)V+57
j  ch.qos.logback.classic.Logger.error(Lorg/slf4j/Marker;Ljava/lang/String;Ljava/lang/Throwable;)V+11
j  org.apache.ignite.logger.slf4j.Slf4jLogger.error(Ljava/lang/String;Ljava/lang/String;Ljava/lang/Throwable;)V+11
j  org.apache.ignite.logger.slf4j.Slf4jLogger.error(Ljava/lang/String;Ljava/lang/Throwable;)V+4
j  org.apache.ignite.internal.GridLoggerProxy.error(Ljava/lang/String;Ljava/lang/Throwable;)V+10
j  org.apache.ignite.internal.util.IgniteUtils.error(Lorg/apache/ignite/IgniteLogger;Ljava/lang/Object;Ljava/lang/Object;Ljava/lang/Throwable;)V+69
j  org.apache.ignite.internal.util.IgniteUtils.error(Lorg/apache/ignite/IgniteLogger;Ljava/lang/Object;Ljava/lang/Throwable;)V+27
j  org.apache.ignite.spi.IgniteSpiThread.run()V+258
v  ~StubRoutines::call_stub

栈顶异常信息: Java_java_util_zip_ZipFile_getEntry+0x85

通过网上查找资料参考其它前辈的博客,知道这是jdk的一个bug,且在这在JDK 9中使用JDK-8145260进行了修复。 大多数情况下,ZIP_GetEntry中的崩溃发生在JVM实例运行时被访问的jar文件被修改/覆盖时。以下属性可用于禁用Jar文件的*目录结构的内存映射:
-Dsun.zip.disableMemoryMapping =true
但请注意,启用此属性会对应用程序产生一些性能影响,因为JVM需要在读取Jar文件条目时一次又一次地从磁盘上的Jar文件读取*目录结构。因此,最好确保在JVM加载了它们的映像时不会修改或覆盖jar文件。而我正是由于在没有停止执行jar包时就远程上传了更改过的jar,才触发了该异常!

参考博客:https://www.cnblogs.com/snifferhu/p/9026064.html

上一篇:元空间、堆、线程在内存中的联系


下一篇:Java8的伪共享和缓存行填充--@Contended注释