lunix 腳本運行時,自動生成hs err pid14165.log
lunix 腳本start.sh
java -server -Xms1024m -Xmx2048m -jar ksdc.war --spring.profiles.active=proc
- 1
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)
- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
- 19
- 20
- 21
- 22
- 23
- 24
- 25
- 26
- 27
- 28
- 29
- 30
- 31
- 32
- 33
- 34
- 35
- 36
- 37
- 38
- 39
- 40
- 41
- 42
- 43
- 44
- 45
- 46
- 47
- 48
- 49
- 50
- 51
- 52
- 53
- 54
- 55
- 56
- 57
- 58
- 59
- 60
- 61
- 62
- 63
- 64
- 65
- 66
- 67
- 68
- 69
- 70
- 71
- 72
- 73
- 74
- 75
- 76
- 77
- 78
- 79
- 80
- 81
- 82
- 83
- 84
- 85
- 86
- 87
- 88
- 89
- 90
- 91
- 92
- 93
- 94
- 95
- 96
- 97
- 98
- 99
- 100
- 101
- 102
- 103
- 104
- 105
- 106
- 107
- 108
- 109
解決方案:
「`
JVM crash了,輸出錯誤到hs_err_pid14165.log日誌。
發現這是個棧溢出的錯誤。並且當前棧剩餘的空間已經很小了(free space =4k)。
因此建議將JVM的Stack的尺寸調大,主要設計兩個參數:「-Xms256m -Xmx1048m 」。但是,將棧的尺寸調大,也意味著在有限的內存資源中,能打開的最大線程數會減少。


※mybatis與spring整合:Dao層映射配置
※C++ 中 的用法
TAG:程序員小新人學習 |