- Plesk for Linux
Apache segmentation fault is caused by extension or interoperability with OS module causes a crash. How to find more detailed logs about why it happened?
Apache crush may have the following symptoms:
Webpages return an HTTP error 500 in the global Apache error log file.
"Segmentation fault" error could be found in global Apache error log file like:
CONFIG_TEXT: seg fault or similar nasty error detected in the parent process
Connect to the server using SSH
Find a partition having a free space enough to store several memory dumps. In this example, it will be root
Modify Apache startup script:
For systemd systems add
[Service]section of the unit file, e.g. for CentOS 7:
# cat /etc/systemd/system/multi-user.target.wants/httpd.service
For Debian-based non-systemd systems open
/etc/init.d/apache2file and locate
do_start()section. Add the following line in this section:
CONFIG_TEXT: ulimit -c unlimited
For RHEL-based OSes with init add
Create a folder where core dumps will be stored:
# mkdir -p /var/coredumps
# chmod a+w /var/coredumps
Note: The folder should be located on a partition having enough space to store core dumps.
Note for CentOS 7: due to
PrivateTmp=trueparameter in a systemd unit, it is not possible to use some directories inside /tmp/ as the directory for core dumps.
/proc/sys/kernel/core_patternto relative path:
# echo /var/coredumps/core-%e-%s-%u-%g-%p-%t > /proc/sys/kernel/core_pattern
Note: if for some reason
core_patterncan not be modified, it will be saved in a directory from where application started or
CoreDumpDirectorylocation (see below).
/etc/apache2/apache2.confand specify a location for a core dump file:
# grep "CoreDumpDirectory" /etc/httpd/conf/httpd.conf
Restart Apache service:
# service httpd restart
# service apache2 restart
In order to make sure coredumps were enabled successfully, send
kill -SIGSEGV <PID>to Apache child and check whether dump file has been created. Files will be named like:
# ls -l /var/coredumps/
abrtddaemon is running, it will prevent creation of core dump files.
Reproduce the issue
Remove modification in apache startup script that was added on step 3 and restart Apache.
To analyse the core dump, pass the core dump filename on the
Install gdb utility:
# yum install gdb
# apt-get install gdb
Run the following command with backslash before ! sign for the actual file name for core-dumps:
# gdb /usr/sbin/apache2 /var/coredumps/core-\!usr\!sbin\!apach-11-0-0-3215-1485908109
btcommand at the
gdbprompt to get backtrace and analyse output:
CONFIG_TEXT: (gdb) bt full