#TIL #linux 프로세스가 어떻게 죽었는지 모를 때, 보는 커널의 메시지 버퍼

덤프가 안 남아서 왜 프로세스가 죽었는지 모를 때, 커널의 메시지 버퍼를 출력해서 보면 실마리를 찾을 수 있다.

$ dmesg -T | grep -i -B100 'killed process'

dmesg 명령어로 커널의 메시지 버퍼를 출력한다. -B 옵션을 사용해서 killed process 앞 라인을 같이 출력한다.

[ pid ]   uid  tgid total_vm      rss pgtables_bytes swapents oom_score_adj name
...
[26864]   601 26864  5526755  4012153 34770944        0             0 beam.smp
[27029]   601 27029     2066      282    61440        0             0 inet_gethost
[27030]   601 27030     3654      406    73728        0             0 inet_gethost
[31181]     0 31181     6438     2147   110592        0             0 atop
[32471]     0 32471    26996      833   253952        0             0 sshd
[32578]   601 32578    26996      450   249856        0             0 sshd
[32579]   601 32579     5813      924    94208        0             0 bash
Out of memory: Kill process 26864 (beam.smp) score 979 or sacrifice child
Killed process 26864 (beam.smp) total-vm:..kB, anon-rss:...kB, file-rss:...kB, shmem-rss:...kB

아~ out of memory 에러로 죽었구나

참고 - What killed my process and why? - stackoverflow.com

Feedback plz <3 @ohyecloudy, ohyecloudy@gmail.com

A Random Post