Tag: Core dump Apache2
First, the basic Environment 1, release version uname -alinux 10.1.10.117 3.2.0-4-amd64 #1 smp debian 3.2.68-1+ DEB7U1 X86_64 GNU/LINUX2, installing APACHE2APT-GET -Y INSTALL APACHE2-MPM-PREFORK3, Create a directory and give permissions Mkdir /opt/game/core -pchown www-data /opt/game/core/ -r two, open core Dump function 1, see if Core dump open ulimit -c0ulimit -acore file size (BLOCKS, -C) 0 parameter Description-c indicates the size limit of the kernel dump file 0 means it is not turned on core Dump function Set the maximum value unit of the core file in chunks. -a Show All current resource limits 2, modify configuration (in kilobytes) cat /etc/security/limits.conf* soft core 2048000* hard core 20480003, effective ulimit -c 20480004, check ulimit - acore file size (blocks, -c) 2048000ulimit -c2048000 Second, modify the core file save path 1, temporary modification 1) core file saved in/opt/game/core directory echo "/opt/game/core/%e.core The core file name generated by the.%s.%p.%h.%t " > /proc/sys/kernel/core_pattern2" will become core.pidecho 1 > / Proc/sys/kernel/core_uses_pid2, permanently modify the 1) add 2 lines at the end of the configuration cat /etc/sysctl.confkernel.core_pattern = / OPT/GAME/CORE/%E.CORE.%S.%P.%H.%TKERNEL.CORE_USES_PID = 12) parameter description of the permanent SYSCTL -P3)%e executable filename (Without path prefix) #dump的文件名%p PID of Dumped process, as seen in the pid namespace in which the process resides #dump的进程PID%t time of dump, expressed as seconds since the Epoch,1970-01-01 00:00:00 +0000 #转储时刻 (number of seconds from January 1, 1970)%h hostname (Same as nodename returned by uname (2)) #主机名%s number of signal causing dump #coredump的信号 Three, apache2 set 1, then/etc/apache2/apache2.conf last add 1 lines cat /etc/ Apache2/apache2.confcoredumpdirectory /opt/game/core2, parameter description syntax:coredumpdirectory Directory-path This command is used to control the kernel dump directory used by Apache, which is located by default under "ServerRoot". Because this directory is generally not writable for the user running the server, kernel dumps generally do not write content. If you need a kernel dump in debugging, you can use this command to specify a different directory. 3, restart Apache2 service/etc/init.d/apache2 restart4, kill apache2 process First view the next apache2 process root 2342 0.0 1.2 71568 2916 ? Ss 02:29 0:00 /usr/sbin/apache2 -k startwww-data 2344 0.0 0.8 71592 2132 ? s 02:29 0:00 /usr /sbin/apache2 -k startwww-data 2345 0.0 0.8 71592 2132 ? s 02:29 0:00 /usr/ sbin/apache2 -k startwww-data 2348 0.0 0.8 71592 2132 ? S 02:29 0:00 /usr/sbin/apache2 -k startwww-data 2349 0.0 0.8 71592 2132 ? S 02:29 0:00 /usr/sbin/apache2 -k startwww-data 2350 0.0 0.8 71592 2132 ? s 02:29 0:00 /usr/sbin/apache2 -k startkill -11 2342kill -11 2344kill -11 2345kill -11 2348kill -11 2349kill -11 2350 Signal 11 Description One) SIGSEGV attempts to access memory that is not assigned to itself, or attempts to write data to a memory address that does not have write permission. 5, see that there is already a core produced ll /opt/game/core/- RW------- 1 root root 2596864 may  21 02:38 APACHE2.CORE.11.2342.10.1.10.117.1432190336-RW------- 1 www-data WWW-DATA 2621440 MAY 21 02:38 APACHE2.CORE.11.2344.10.1.10.117.1432190338-RW------- 1 www-data www-data 2621440 May 21 02:38 APACHE2.CORE.11.2345.10.1.10.117.1432190339-RW------- 1 www-data www-data 2621440 may  21 02:39 APACHE2.CORE.11.2348.10.1.10.117.1432190344-RW------- 1 www-data WWW-DATA 2621440 MAY 21 02:39 APACHE2.CORE.11.2349.10.1.10.117.1432190346-RW------- 1 www-data www-data 2621440 May 21 02:39 apache2.core.11.2350.10.1.10.117.14321903496, using GDB program 1) First install Gdbapt-get -y instALL GDB2) Use the GDB program to view gdb apache2 -core /opt/game/core/ apache2.core.11.2342.10.1.10.117.1432190336gnu gdb (GDB) 7.4.1-debianCopyright (C) 2012 free software foundation, inc.license gplv3+: gnu gpl version 3 or later
This article is from the "7928217" blog, please be sure to keep this source http://7938217.blog.51cto.com/7928217/1671716
Apache2 setting up the core dump file (DEBIAN7)