记一次tomcat自动退出问题

问题

环境: centos/tomcat8/jdk1.8

最近遇到部署在服务器的tomcat总是过一段时间就自动结束进程 ;
通过监控tomcat 日志文件(tail -f ./logs/catalina.out)并没有发现有任何异常

分析解决

  • 通过网络搜索是因为可能是由于Linux OOM Killer导致
  • 监控/var/log/messages 发现确实由于这种原因
tail -f /var/log/messages
...
Jun 17 15:31:00 robinjzy kernel: Out of memory: Kill process 17404 (java) scd
Jun 17 15:31:00 robinjzy kernel: Killed process 17404 (java) total-vm:235268ile-rss:0kB, shmem-rss:0kB
...

Linux OOM Killer的描述中有这样一句话
Any particular process leader may be immunized against the oom killer if the value of its /proc//oomadj is set to the constant OOM_DISABLE (currently defined as -17).

如果将其/proc//oomadj的值设置为常量OOM_DILD(当前定义为-17),则可以对任何特定的进程领导人进行OOM杀手免疫。

依此做为解决的依据;

解决

原文地址:https://www.cnblogs.com/52liming/p/9537138.html