[Linux] gdb crash之后,杀掉僵尸进程的办法
2007-12-24 16:17
155 查看
gdb调试程序的时候,有时gdb会因为某些原因crash掉。这时被调试的那个进程往往就成了僵尸进程。这种僵尸进程用killall是杀不掉的,用kill -9或者kill -SIGKILL也是杀不掉的,甚至退出用户登录也杀不掉。很多人这时候只好reboot机器。
我在网上查了很多资料,都没有说到其他解决办法。
我认为linux不应该会这么弱智,也许是我用错了signal,因此就从kill -0 pid开始逐个尝试,终于发现用kill -18就能杀掉gdb产生的僵尸进程。信号18是SIGCONT,这个信号可以让停在断点上的进程继续运行。我分析原因,认为这是由于:停在断点上的进程不会响应除了SIGCONT之外的任何信号。
维基百科上说:
When SIGSTOP is sent to a process, the usual behaviour is to pause that process in its current state. The process will only resume execution if it is sent the SIGCONT signal. SIGSTOP and SIGCONT are used for job control in the Unix shell, among other purposes. SIGSTOP cannot be caught or ignored.
这证实了我的想法。
我在网上查了很多资料,都没有说到其他解决办法。
我认为linux不应该会这么弱智,也许是我用错了signal,因此就从kill -0 pid开始逐个尝试,终于发现用kill -18就能杀掉gdb产生的僵尸进程。信号18是SIGCONT,这个信号可以让停在断点上的进程继续运行。我分析原因,认为这是由于:停在断点上的进程不会响应除了SIGCONT之外的任何信号。
维基百科上说:
When SIGSTOP is sent to a process, the usual behaviour is to pause that process in its current state. The process will only resume execution if it is sent the SIGCONT signal. SIGSTOP and SIGCONT are used for job control in the Unix shell, among other purposes. SIGSTOP cannot be caught or ignored.
这证实了我的想法。
相关文章推荐
- [Linux] gdb crash之后,杀掉僵尸进程的办法
- Linux下杀僵尸进程办法
- Linux下杀僵尸进程办法
- linux下的僵尸进程处理办法
- linux 僵尸进程解决办法
- Linux 下 popen 函数引起的僵尸进程 defunct 以及解决办法
- Linux下杀僵尸进程办法
- Linux下杀僵尸进程办法
- linux 僵尸进程
- Linux的僵尸进程产生原因及解决方法
- linux杀掉僵尸进程
- linux_wait()与僵尸进程
- Fedora 下 Google-Chrome 经常出现僵尸进程的权宜办法
- linux 如何清理僵尸进程
- linux defunct僵尸进程
- Linux — 孤儿进程和僵尸进程
- Linux进程_僵尸和孤儿
- Linux中如何杀掉僵尸进程
- 转载 linux 僵尸进程,讲的很透彻
- linux 中 signal 用法回收子进程结束产生的僵尸进程