一、报错概览
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000, pid=2608, tid=0x00002504 # # JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11) # Java VM: Java HotSpot(TM) Client VM (25.131-b11 mixed mode windows-x86 ) # Problematic frame: # C 0x00000000 # # Core dump written. Default location: C:\Users\Administrator\Desktop\aerotop-led-project\hs_err_pid2608.mdmp # # 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. #
今天在运行java程序的时候报了如上所示的一个错误,然后查看日志,通过在百度上查询,给出了几种解决方案都不能彻底解决这个错误,依然会报错,再向下看日志时发现jvm堆内存和元空间的使用情况,如下所示:
Heap: def new generation total 44672K, used 13804K [0x05000000, 0x08070000, 0x0a550000) eden space 39744K, 30% used [0x05000000, 0x05bab018, 0x076d0000) from space 4928K, 37% used [0x07ba0000, 0x07d70208, 0x08070000) to space 4928K, 0% used [0x076d0000, 0x076d0000, 0x07ba0000) tenured generation total 98972K, used 59381K [0x0a550000, 0x105f7000, 0x15000000) the space 98972K, 59% used [0x0a550000, 0x0df4d4f0, 0x0df4d600, 0x105f7000) Metaspace used 63522K, capacity 65876K, committed 66048K, reserved 66944K
虽然没有报OOM的错误,但是还是存在侥幸心理去改堆内存和元空间的大小,但是还是报错。
二、解决方法:
# # A fatal error has been detected by the Java Runtime Environment: # # EXCEPTION_ACCESS_VIOLATION (0xc0000005) at pc=0x00000000, pid=2608, tid=0x00002504 # # JRE version: Java(TM) SE Runtime Environment (8.0_131-b11) (build 1.8.0_131-b11) # Java VM: Java HotSpot(TM) Client VM (25.131-b11 mixed mode windows-x86 ) # Problematic frame: # C 0x00000000 # # Core dump written. Default location: C:\Users\Administrator\Desktop\aerotop-led-project\hs_err_pid2608.mdmp # # 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. #
在最开始的日志消息中,发现了一个关键词Problematic frame:,下面显示的是文件名,于是定位到该文件中,发现是用于多个定时任务同时处理该方法造成的,导致报错,修改程序后,解决问题。