2

I'm running Centos 7 with php-fpm 5.4. I'm encountering a (signal 11) SIGSEGV error in my php-fpm error logs and want to debug it.

I've followed the advice of php5 fpm: how do you generate core dump from segfault? but php-fpm is still not even attempting to generate core dumps. From the php-fpm error log:

WARNING: [pool website.com] child 26953 exited on signal 11 (SIGSEGV) after 0.931337 seconds from start

If a core dump had been generated, it would read (SEGSEGV - core dumped) but it doesn't.

3 Answers 3

1

I also had trouble with this. It seems that on centos the master php-fpm process is launched with root privileges, which then launches the individual pools with reduced privileges (user php-fpm on centos by default).

The stumbling block for me, and I suspect for you too, is that if a process has changed it's own execution privileges, it is not permitted to produce a core dump file unless /proc/sys/fs/suid_dumpable is set to allow this. See information about this kernel-level control here.

1
  • 1
    For anyone finding this from a search, that link is dead but I had the same issue with suid_dumpable and fixed it with sysctl fs.suid_dumpable=2 and restarting PHP-FPM. Commented Nov 24, 2020 at 1:55
0

I was able to solve this problem with the following:

  1. Added to /etc/systemd/system.conf file:

DefaultLimitCORE=infinity

  1. Changed the kernel.core_pattern:

sysctl kernel.core_pattern='| /usr/lib/systemd/systemd-coredump %p %u %g %s %t %c %e'

  1. Reloaded systemd configuration:

systemctl daemon-reload

As an extra step for php-fpm, the following directive needs to be set in the individual php-fpm pool files you want to monitor:

rlimit_core = unlimited

The default directory for the systemd-coredump program is /var/lib/systemd/coredump so you should see dump files generated here.

0

PHP-FPM switcher user before starting the pools. Hence I had to change fs.suid_dumpable to 1 as mentioned on

https://itnext.io/linux-processes-core-dumps-systemd-coredump-and-debian-cf2ddb11ef9e

sysctl -w fs.suid_dumpable=1 

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.