1)Tomcat崩溃kernel: java invoked oom-killer: gfp_mask
场景
Jan 16 03:03:57 host-172-16-61-102 vm-agent: network-posix.c GetIpv4VifIp 1201 : failed to GetIpv4VifGateway
Jan 16 03:03:57 host-172-16-61-102 vm-agent: popen error
Jan 16 03:03:58 host-172-16-61-102 vm-agent: popen error
Jan 16 03:03:58 host-172-16-61-102 vm-agent: disk-posix.c getCmdInfo 1686 : exec cmd ls -l /sys/block | grep pci00 failed.
Jan 16 03:03:58 host-172-16-61-102 vm-agent: disk-posix.c getCmdInfo 1686 : exec cmd ls -l /sys/block/*/device failed.
Jan 16 03:03:58 host-172-16-61-102 vm-agent: disk-posix.c getDiskLocation 2305 : get disk vda cmd info failed.
Jan 16 03:03:58 host-172-16-61-102 vm-agent: extend_fun.c check_process_handles 1518 : Failed to exec shell command.
Jan 16 03:03:58 host-172-16-61-102 vm-agent: extend_fun.c check_process_memory 1563 : Failed to exec shell command.
Jan 16 03:04:20 host-172-16-61-102 kernel: java invoked oom-killer: gfp_mask=0x14201ca(GFP_HIGHUSER_MOVABLE|__GFP_COLD), nodemask=(null), order=0, oom_score_adj=0
Jan 16 03:04:20 host-172-16-61-102 kernel: java cpuset=/ mems_allowed=0
Jan 16 03:04:20 host-172-16-61-102 kernel: CPU: 14 PID: 5309 Comm: java Kdump: loaded Not tainted 4.14.0-115.el7a.0.1.aarch64 #1
Jan 16 03:04:20 host-172-16-61-102 kernel: Hardware name: QEMU KVM Virtual Machine, BIOS 0.0.0 02/06/2015
Jan 16 03:04:20 host-172-16-61-102 kernel: Call trace:
Jan 16 03:04:20 host-172-16-61-102 kernel: [<ffff000008089e14>] dump_backtrace+0x0/0x23c
Jan 16 03:04:20 host-172-16-61-102 kernel: [<ffff00000808a074>] show_stack+0x24/0x2c
Jan 16 03:04:20 host-172-16-61-102 kernel: [<ffff0000088568a8>] dump_stack+0x84/0xa8
解决
调整JVM 最大内存,小于系统最大物理内存
2)Cannot find /etc/bin/setclasspath.sh解决方案
场景
配置Tomcat作为服务启动
创建软连接ln -s /opt/web/apache-tomcat-8.5.41/bin/catalina.sh /etc/init.d/tomcat
添加开机启动 chkconfig --add tomcat
手动启动测试如下:
[root@localhost bin]# service tomcat start
Cannot find /etc/bin/setclasspath.sh
This file is needed to run this program
解决
setclasspath.sh脚本跟catalina.sh脚本是在同一个目录,说明没有找到对应的启动目录,修改catalina.sh文件,指定tomcat的安装目录
#!/bin/sh
#chkconfig: 2345 80 90
#description: tomcat auto start
#processname: tomcat
#JAVA_HOME=/usr/lib/jvm/jre-1.8.0
CATALINA_HOME=/opt/web/apache-tomcat-8.5.41/
添加最后一行即可