简体   繁体   English

SIGSEGV不会终止该过程

[英]SIGSEGV does not terminate the process

I have a multithreaded application that runs 30-something threads. 我有一个运行30多个线程的多线程应用程序。 I know there is a bug where sometimes two threads attempt to sort one list simultaneously and this usually results in one of the threads accessing invalid memory. 我知道有一个错误,有时两个线程试图同时对一个列表进行排序,这通常导致其中一个线程访问无效的内存。 Thus, a SIGSEGV is generated for that thread. 因此,将为该线程生成一个SIGSEGV

Now, from what I understand about signals, the thread should call SIG_DFL for SIGSEGV , which is abnormal termination of the process and a coredump. 现在,根据我对信号的了解,线程应为SIGSEGV调用SIG_DFL ,这是进程和coredump的异常终止。 However, I saw the process being still alive (in a kind of limbo state) where the execution halted, but the process was still alive. 但是,我看到该进程仍然处于活动状态(处于一种边缘状态),执行停止了,但是该进程仍然处于活动状态。 When I tried to kill it, the SIGTERM was actually propagated to my custom signal handler (which attempts to nicely shut down all the threads), but there it hang up, because none of the threads were actually executing anymore. 当我尝试kill它时, SIGTERM实际上传播到了我的自定义信号处理程序(它试图很好地关闭所有线程),但由于没有一个线程实际在执行,它在那里挂断了。 I finally managed to kill it using SIGQUIT and the corefile was generated after that. 我终于设法使用SIGQUIT杀死了它,然后生成了corefile。

So my question is what is meant by "abnormal termination"? 所以我的问题是“异常终止”是什么意思? How can a process not be removed from the memory if the SIG_DFL is called for SIGSEGV ? 如果为SIGSEGV调用了SIG_DFL如何不能从内存中删除进程? What could possible be going on that caused such behaviour? 导致这种行为的可能原因是什么? My Linux is Red Hat Enterprise Linux Server release 5.11 (Tikanga) 我的Linux是Red Hat Enterprise Linux Server版本5.11(Tikanga)

EDIT: I know (more or less) how to debug it and I even know what the bug is. 编辑:我知道(或多或少)如何调试它,甚至我知道该错误是什么。 My question is more or less: What exactly RedHat does when SIG_DFL is called with SIGSEGV? 我的问题或多或少:当使用SIGSEGV调用SIG_DFL时,RedHat到底会做什么? The problem here is that the process was not responding, but was not dead either - therefore the automatic restart procedure did not kick in and we had some unpleasant downtime. 这里的问题是该进程没有响应,但也没有死-因此自动重启过程没有启动,并且我们有一些令人不愉快的停机时间。

The situation was not as straightforward as I thought. 情况并不像我想的那么简单。 The original problem was a deadlock between two of the threads. 最初的问题是两个线程之间的死锁。 When I issued SIGTERM, then actually my custom signal handler caused a segfault in the (now un-)deadlocked threads. 当我发布SIGTERM时,实际上我的自定义信号处理程序在(现在已解除锁定)死锁的线程中造成了段错误。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM