본문 바로가기

CentOS

CentOS 7+Apache 2.4 coredump 설정

- 설치환경 

[root@noyeah ~]# cat /etc/redhat-release 
CentOS Linux release 7.9.2009 (Core)
[root@noyeah ~]# apachectl -v
Server version: Apache/2.4.3 (Unix)
Server built:   Mar 11 2021 09:56:19

 

1. corefile 설정

# [root@noyeah ~]# ulimit -a
core file size          (blocks, -c) 0

[root@noyeah ~]# ulimit -c unlimited 

[root@noyeah ~]# ulimit -a
core file size          (blocks, -c) unlimited

[root@noyeah ~]# sysctl -a |grep core

===
kernel.core_pattern = core
kernel.core_pipe_limit = 0
kernel.core_uses_pid = 1

===

# cp -arp /etc/security/limits.conf  /etc/security/limits.conf_origin or  날짜

===

-rw-r--r-- 1 root root 2422  4월  1  2020 /etc/security/limits.conf

-rw-r--r-- 1 root root 2422  4월  1  2020 /etc/security/limits.conf_origin

===

[root@noyeah ~]# head -61 /etc/security/limits.conf  | tail -1

===

*  -  core    unlimited

===

# cat /etc/profile | grep ulimit

조회되지 않아야 정상

 

2. apache coredump 설정추가

[root@noyeah ~]# mkdir /usr/local/apache/coredump
[root@noyeah ~]# chmod -R 755 /usr/local/apache/coredump

cat conf/httpd.conf | grep coredump

===
CoreDumpDirectory /usr/local/apache/coredump

===

[root@noyeah ~]# apachectl restart

 

3. Kill test

- root 프로세스 확인

[root@noyeah ~]# ps -ef | grep httpd
root     17792     1  0 10:16 ?        00:00:00 /usr/local/apache/bin/httpd -k start
nobody   17793 17792  0 10:16 ?        00:00:04 /usr/local/apache/bin/httpd -k start
nobody   17794 17792  0 10:16 ?        00:00:04 /usr/local/apache/bin/httpd -k start
nobody   17795 17792  0 10:16 ?        00:00:04 /usr/local/apache/bin/httpd -k start
root     19278 28514  0 11:28 pts/0    00:00:00 grep --color=auto http

 

- root 프로세스 강제종료

[root@noyeah ~]# kill -SIGFPE 17792
[root@noyeah ~]# ps -ef | grep httpd
nobody   17793     1  0 10:16 ?        00:00:04 /usr/local/apache/bin/httpd -k start
nobody   17794     1  0 10:16 ?        00:00:04 /usr/local/apache/bin/httpd -k start
nobody   17795     1  0 10:16 ?        00:00:04 /usr/local/apache/bin/httpd -k start
root     19352 28514  0 11:30 pts/0    00:00:00 grep --color=auto httpd

 

- coredump 파일 생성여부 확인
[root@noyeah ~]# ll /usr/local/apache/coredump/
합계 7392
-rw------- 1 root root 7581696  3월 11 11:32 core.19536   
--> root 데몬 ps kill 시 생성된 coredump 파일 

 

4. gdb로 확인

[root@noyeah ~]# yum -y install gdb

[root@noyeah ~]# gdb /usr/local/apache/coredump/core.19536
GNU gdb (GDB) Red Hat Enterprise Linux 7.6.1-120.el7
Copyright (C) 2013 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http: //gnu.org/licenses/gpl.html>

This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.  Type "show copying"
and "show warranty" for details.
This GDB was configured as "x86_64-redhat-linux-gnu".
For bug reporting instructions, please see:

<http://www.gnu.org/software/gdb/bugs/>...

[New LWP 19536]
Missing separate debuginfo for the main executable file
Try: yum --enablerepo='*debug*' install /usr/lib/debug/.build-id/73/df8c4584015d96ac65c5e4c1c4e0fa95ac13b0
Core was generated by `/usr/local/apache/bin/httpd -k start'.
Program terminated with signal 8, Arithmetic exception.
#0  0x00007f6f5b464a13 in ?? ()
"/usr/local/apache/coredump/core.19536" is a core file.
Please specify an executable to debug.
(gdb) bt
#0  0x00007f6f5b464a13 in ?? ()
#1  0x00007f6f5c1d6195 in ?? ()
#2  0x0000000000000000 in ?? ()
(gdb) frame 1
#1  0x00007f6f5c1d6195 in ?? ()
(gdb) quit

'CentOS' 카테고리의 다른 글

계정 패스워드 만료일 설정  (0) 2021.04.16
MySQL DataDir 변경(DB 재생성)  (0) 2021.03.08
Sendmail 설치  (0) 2021.02.28
[CentOS 7] 설치 및 세팅  (1) 2020.07.01