Linux Kernel Messages

10 Oct 2014

Have you had experiences for executing a long running process but it was terminated for no obvious reasons?

The cause for such issue could be many; what you can do is try to read the logging messages from kernel to figure out why. Kernel logs messages in the kernel ring buffer,; and there are tools to help you print out those messages to stdout, for example, dmesg.

For detailed usage of dmesg, try man dmesg in your terminal. When a process is terminated by a kernel, it usually logs the reason why the process was killed, and dmesg should be able to give you some hints.

There was once I found a process I ran crashed for no reason, and there was no core dump produced along with that crash. Then I did the follwing with the terminated process’s pid:

dmesg | grep pid

Then I found it was killed by kernel because of ‘out of memory’ in the OS. Aparrently the terminated process used too much memory therefore killed by the kernel!

REFERENCE