Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1232088
  • 博文数量: 177
  • 博客积分: 1528
  • 博客等级: 上尉
  • 技术积分: 1891
  • 用 户 组: 普通用户
  • 注册时间: 2010-12-15 18:03
文章分类

全部博文(177)

文章存档

2020年(1)

2018年(19)

2017年(4)

2016年(21)

2015年(40)

2014年(13)

2013年(26)

2012年(16)

2011年(37)

我的朋友

分类: LINUX

2014-08-05 16:20:17


背景:在程序开发过程中,遇到了一个进程服务本地测试通过,而在部署到服务器以后频繁收到SIGKILL信号,从而导致进程频繁重启。关于SIGKILL信号的捕获,可以通过strace工具来确认,也可以在进程中使用signal调用捕获信号。

在下列几种情况下,系统会发送SIGKILL信号:

1、OOM killer。out of memory 

2、CPU-time resource hard limit。

3、ptrace() 
Another fairly 'standard' case is when the process tracing another
process using ptrace() dies without stopping the tracing; the traced
process is sent a SIGKILL then. Since the process in this case is
being actively traced with gdb, that would apparently not apply here,
but it does explain why killing gdb will kill a process that gdb is
attached to.
4、bad memory hardware (usually results in SIGSEGVs, but it looks like there are cases where SIGKILL will be generated)

5、network or pseudo filesystem being ripped out from under the process

6、hit the SysReq key

7、various "secure computing" setups which restrict the operations a process can use


追查上述问题一般性步骤:
    1、 ulimit -a 产生程序运行core文件,以确认进程无coredump情况。
    2、 检查crontab服务,是否有定时服务杀掉相应进程。
    3、 确认其他进程日志,是否有其他进程误杀当前进程。
    4、 查看/var/log/message系统日志,当前进程是否存在内存泄漏,从而导致的OOM KILL
    5、 ulimit -t 查看是否占用CPU过长时间,不过一般情况系统不做该限制。

    本情况是由问题3锁导致的。
           



阅读(4237) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~