进程消失

视频地址:进程消失

平时我们一般排查的问题都是进程存在,可以使用一些工具来定位问题。但是进程消失后不知道如何定位了。

下面都基于linux来讲解。

进程既然消失了那肯定需要从已经留下过的痕迹来开始定位问题,一般会存在什么痕迹呢?

  1. crash产生的core file。
  2. java crash产生的hs_err文件。(通过添加启动参数-XX:ErrorFile=path)
  3. 服务自身日志
  4. Java dump文件
  5. 系统日志

以上方式对于当前的case都没有,只能查看系统日志。
使用命令:dmesg | grep "Killed",如图所示:

dmesg.png

因为OOM被系统kill掉了,这是linux系统的一种自我保护机制。
系统资源是2U4G的。当内存要达到4G时则触发了kill。

demsg日志中total-vm,anon-rss,file-rss代表的意思参考如下:

Part of the RSS is allocated in real memory blocks (other than mapped into a file or device). This is anonymous memory ("anon-rss") and there is also RSS memory blocks that are mapped into devices and files ("file-rss").
So, if you open a huge file in vim, the file-rss would be high, on the other side, if you malloc() a lot of memory and really use it, your anon-rss would be high also.
On the other side, if you allocate a lot of space (with malloc()), but nevers use it, the total-vm would be higher, but no real memory would be used (due to the memory overcommit), so, the rss values would be low.

你可能感兴趣的:(进程消失)