前两天,nginx进程莫名奇妙挂了,查看nginx的错误日志,看到一些错误
2017/09/21 22:05:17 [alert] 28916#0: worker process 28937 exited on signal 11
2017/09/21 22:05:17 [alert] 28916#0: worker process 24281 exited on signal 11
2017/09/21 22:05:17 [alert] 28916#0: worker process 24302 exited on signal 11
2017/09/21 22:05:17 [alert] 28916#0: worker process 24283 exited on signal 11
2017/09/21 22:05:17 [alert] 28916#0: worker process 24299 exited on signal 7
2017/09/21 22:05:17 [alert] 28916#0: worker process 24301 exited on signal 11
2017/09/21 22:05:17 [alert] 28916#0: worker process 24305 exited on signal 11
2017/09/21 22:05:17 [alert] 28916#0: worker process 28930 exited on signal 11
其中,signal 11 为段错误SIGSEGV,signal 7 为SIGBUS错误
需要开启core dump来定位错误,
但是ulimit -S -c unlimited 这样的设置,要重启应用才能生效,
想要不重启应用来开启core dump。
具体设置方法如下:
- 找到进程号,假设进程号是42301
- 向/proc/42301/limits 输入设置值
$> ps -ef | grep nginx
$> sudo bash -c "echo -n 'Max core file size=unlimited:unlimited' > /proc/42301/limits"