lunix 脚本运行时,自动生成hs_err_pid14165.log,


lunix 脚本start.sh

java -server -Xms1024m -Xmx2048m -jar ksdc.war --spring.profiles.active=proc

chmod u+x start.sh

./start.sh 即可执行脚本

异常内容

#
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 715849728 bytes for committing reserved memory.
# Possible reasons:
#   The system is out of physical RAM or swap space
#   In 32 bit mode, the process size limit was hit
# Possible solutions:
#   Reduce memory load on the system
#   Increase physical memory or swap space
#   Check if swap backing store is full
#   Use 64 bit Java on a 64 bit OS
#   Decrease Java heap size (-Xmx/-Xms)
#   Decrease number of Java threads
#   Decrease Java thread stack sizes (-Xss)
#   Set larger code cache with -XX:ReservedCodeCacheSize=
# This output file may be truncated or incomplete.
#
#  Out of Memory Error (os_linux.cpp:2673), pid=14165, tid=140698878138112
#
# JRE version:  (8.0_45-b14) (build )
# Java VM: Java HotSpot(TM) 64-Bit Server VM (25.45-b02 mixed mode linux-amd64 compressed oops)
# Failed to write core dump. Core dumps have been disabled. To enable core dumping, try "ulimit -c unlimited" before starting Java again
#

---------------  T H R E A D  ---------------

Current thread (0x00007ff6fc008800):  JavaThread "Unknown thread" [_thread_in_vm, id=14166, stack(0x00007ff70296d000,0x00007ff702a6e000)]

Stack: [0x00007ff70296d000,0x00007ff702a6e000],  sp=0x00007ff702a6c300,  free space=1020k
Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
V  [libjvm.so+0xaac99a]  VMError::report_and_die()+0x2ba
V  [libjvm.so+0x4f333b]  report_vm_out_of_memory(char const*, int, unsigned long, VMErrorType, char const*)+0x8b
...
V  [libjvm.so+0x62f635]  init_globals()+0x65
V  [libjvm.so+0xa5a02e]  Threads::create_vm(JavaVMInitArgs*, bool*)+0x23e
V  [libjvm.so+0x6c3244]  JNI_CreateJavaVM+0x74
C  [libjli.so+0x745e]  JavaMain+0x9e
C  [libpthread.so.0+0x7dc5]  start_thread+0xc5


---------------  P R O C E S S  ---------------

Java Threads: ( => current thread )

Other Threads:

=>0x00007ff6fc008800 (exited) JavaThread "Unknown thread" [_thread_in_vm, id=14166, stack(0x00007ff70296d000,0x00007ff702a6e000)]

VM state:not at safepoint (not fully initialized)

VM Mutex/Monitor currently owned by a thread: None

GC Heap History (0 events):
No events

Deoptimization events (0 events):
No events

Internal exceptions (0 events):
No events

Events (0 events):
No events


Dynamic libraries:
00400000-00401000 r-xp 00000000 fd:01 1312630                            ...

---------------  S Y S T E M  ---------------

OS:CentOS Linux release 7.2.1511 (Core) 

uname:Linux 3.10.0-514.26.2.el7.x86_64 #1 SMP Tue Jul 4 15:04:05 UTC 2017 x86_64
libc:glibc 2.17 NPTL 2.17 
rlimit: STACK 8192k, CORE 0k, NPROC 3897, NOFILE 65535, AS infinity
load average:0.00 0.01 0.05

/proc/meminfo:
...
DirectMap2M:      991232 kB
DirectMap1G:           0 kB


CPU:total 1 (1 cores per cpu, 1 threads per core) family 6 model 79 stepping 1, cmov, cx8, fxsr, mmx, sse, sse2, sse3, ssse3, sse4.1, sse4.2, popcnt, avx, avx2, aes, clmul, erms, rtm, 3dnowpref, lzcnt, tsc, bmi1, bmi2, adx

/proc/cpuinfo:
processor   : 0
vendor_id   : GenuineIntel
..
fpu_exception   : yes
cpuid level : 13
wp      : yes
flags       : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm constant_tsc rep_good nopl eagerfpu pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch fsgsbase tsc_adjust bmi1 hle avx2 smep bmi2 erms invpcid rtm rdseed adx smap xsaveopt
bogomips    : 4988.44
clflush size    : 64
cache_alignment : 64
address sizes   : 46 bits physical, 48 bits virtual
power management:



Memory: 4k page, physical 1016396k(73016k free), swap 0k(0k free)

vm_info: Java HotSpot(TM) 64-Bit Server VM (25.45-b02) for linux-amd64 JRE (1.8.0_45-b14), built on Apr 10 2015 10:07:45 by "java_re" with gcc 4.3.0 20080428 (Red Hat 4.3.0-8)

time: Wed Jan  3 10:30:45 2018
elapsed time: 0 seconds (0d 0h 0m 0s)

解决方案:
“`
JVM crash了,输出错误到hs_err_pid14165.log日志。

发现这是个栈溢出的错误。并且当前栈剩余的空间已经很小了(free space =4k)。

因此建议将JVM的Stack的尺寸调大,主要设计两个参数:“-Xms256m -Xmx1048m ”。但是,将栈的尺寸调大,也意味着在有限的内存资源中,能打开的最大线程数会减少。

版权声明:本文为博主原创文章,未经博主允许不得转载。 http://blog.csdn.net/weixin_39947101/article/details/78958891

相关内容