./startWebLogic.sh: line 74: 30374
已杀死${JAVA_HOME}/bin/java ${JAVA_VM} ${MEM_ARGS} ${JAVA_OPTIONS}
-Dweblogic.Name=${SERVER_NAME}
-Dweblogic.ProductionModeEnabled=${PRODUCTION_MODE}
-Djava.security.policy="${WL_HOME}/server/lib/weblogic.policy"
-DCONFIG.FILE="/cpic/cxuca/cpiclh/config/IesConfig.xml"
weblogic.Server
但是无论从堡垒机、命令记录等都无法找到是哪里发出的kill命令,偶然间翻查linux日志,发现如下记录:
Apr 24 22:57:34 localhost kernel: oom-killer: gfp_mask=0xd0
通过查阅,oom-killer是redhat
linux的操作系统的自我保护机制,当操作系统无法分配内存时,会选择性地干掉一些回收内存收益较高的进程,来释放内存。操作系统会根据进程的内存消耗量、cpu时间、存活时间、oom_adj来判断该干掉哪个进程,总而言之,就是去干掉那些“收益”最大的进程。
在我们的环境中,webolgic占用的内存最大,2G左右,很容易成为操作系统想要干掉的头号目标,我们通过日志也可以发现:
Apr 23 09:39:47 localhost kernel: Free
pages:14816kB (1600kB
HighMem)
Apr 23 09:39:47 localhost kernel: Active:1142759 inactive:183980
dirty:10 writeback:0 unstable:0 free:3704 slab:19772 mapped:355415
pagetables:1180
Apr 23 09:39:47 localhost kernel: DMA free:12416kB min:16kB
low:32kB high:48kB active:0kB inactive:0kB present:16384kB
pages_scanned:1446 all_unreclaimable? yes
Apr 23 09:39:47 localhost kernel: protections[]: 0 0 0
Apr 23 09:39:47 localhost kernel: Normal free:800kB min:928kB
low:1856kB high:2784kB active:160kB inactive:192kB present:901120kB
pages_scanned:700 all_unreclaimable? yes
Apr 23 09:39:47 localhost kernel: protections[]: 0 0 0
Apr 23 09:39:47 localhost kernel: HighMem free:1600kB min:512kB
low:1024kB high:1536kB active:4570876kB inactive:735728kB
present:8519680kB pages_scanned:0 all_unreclaimable? no
Apr 23 09:39:48 localhost kernel: protections[]: 0 0 0
Apr 23 09:39:48 localhost kernel: DMA: 4*4kB 4*8kB 3*16kB 3*32kB
1*64kB 3*128kB 2*256kB 0*512kB 1*1024kB 1*2048kB 2*4096kB =
12416kB
Apr 23 09:39:48 localhost kernel: Normal: 20*4kB 10*8kB 0*16kB
0*32kB 0*64kB 1*128kB 0*256kB 1*512kB 0*1024kB 0*2048kB 0*4096kB =
800kB
Apr 23 09:39:48 localhost kernel: HighMem: 0*4kB 6*8kB 27*16kB
13*32kB 5*64kB 1*128kB 1*256kB 0*512kB 0*1024kB 0*2048kB 0*4096kB =
1600kB
Apr 23 09:39:48 localhost kernel: Swap cache: add 2410, delete
1643, find 404/525, race 0+0
Apr 23 09:39:48 localhost kernel: 0 bounce buffer pages
Apr 23 09:39:48 localhost kernel: Free
swap:2025580kB
Apr 23 09:39:48 localhost kernel: 2359296 pages of RAM
Apr 23 09:39:48 localhost kernel: 1867760 pages of HIGHMEM
Apr 23 09:39:48 localhost kernel: 282169 reserved pages
Apr 23 09:39:48 localhost kernel: 930319 pages shared
Apr 23 09:39:48 localhost kernel: 767 pages swap cached
Apr 23 09:39:48 localhost kernel: Out of Memory: Killed process
16064 (java).
Apr 23 09:39:48 localhost kernel: oom-killer: gfp_mask=0xd0
其中
Apr 23 09:39:48 localhost kernel: Out of Memory: Killed process
16064 (java).
可以发现,我们的java进程已经被无情地干掉了。
详细查看oom时刻的内存信息
Apr 23 09:39:47 localhost kernel: Normal free:800kB min:928kB
low:1856kB high:2784kB active:160kB inactive:192kB
Normal区内存当前剩余800Kb,而最小值为928kb,已经低于最小值。
根据监控来看,物理内存实际上并未消耗殆尽。如下:
触发OOM的原因可能是我们目前的操作系统版本原因,当前操作系统版本为RHEL4.5 32bit,在分配和使用上会有low
memory限制,当I/O负载过高可能就会发生一些问题。
综上,提供解决方法如下:
1、使用vm.lower_zone_protection 来保护 Normal zone.
调整内核参数:vm.lower_zone_protection=250
2、使用hugemem kernel 扩展 Normal zone 到 4GB.
安装hugemem内核,重启系统,选择此内核。
3、在64位系统中,所有的内存都会分配给ZONE_NORMAL,所有low
memory不会影响64位的系统,所以升级到64为系统是可以彻底解决此问题的方法。