Program terminated with signal 6, Aborted,有可能啥原因呢?

时间:2022-06-19 20:12:08

Program terminated with signal 6, Aborted,有可能啥原因呢?其中一种原因就是事实上的OOM(虽然/var/log/message中没有标明操作系统kill了进行,应该是进程内部初始化已申请内存时报错了,因为malloc的申请会被OS尽可能延后的分配,所以很有可能已经申请的内存早就OOM了,但是程序还可以运行一段时间,甚至很久,除非设置了lock in memory,比如jdk和oracle、mysql都支持这么做)

Program terminated with signal 6, Aborted,有可能啥原因呢?

abort() sends the calling process the SIGABRT signal, this is how abort() basically works.

abort() is usually called by library functions which detect an internal error or some seriously broken constraint. For example malloc() will call abort() if its internal structures are damaged by a heap overflow.

in most cases SIGABRT was sent by libc trying to call free() on a non-initialized/corrupted pointer

It usually happens when there is a problem with memory allocation.

 

SIGABRT is commonly used by libc and other libraries to abort the program in case of critical errors. For example, glibc sends an SIGABRT in case of a detected double-free or other heap corruptions.

Also, most assert implementations make use of SIGABRT in case of a failed assert.

Furthermore, SIGABRT can be sent from any other process like any other signal. Of course, the sending process needs to run as same user or root.

 

参考:https://*.com/questions/3413166/when-does-a-process-get-sigabrt-signal-6