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.

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.

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.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.