Reputation: 1
I am trying to generate core dumps when PHP fails with WARNING: [pool www] child 2756 exited on signal 11 (SIGSEGV) after 153.518521 seconds from start
.
I am using a custom Docker container based on Alpine hosted on ECS.
I've followed multiple guides but PHP-FPM doesn't generate core dumps (I can generate core dump with php cli or with kill -s SIGSEGV $$
). Guides I followed :
- https://ma.ttias.be/generate-php-core-dumps-segfaults-php-fpm/ https://www.bggofurther.com/2015/04/generating-core-dumps-for-php-fpm/
- Core dump file is not generated
My config is the following :
/ # ulimit -c
unlimited
/ # cat /proc/sys/kernel/core_pattern
/tmp/core-dumps/core-%t-%p
/ # cat /proc/sys/kernel/core_uses_pid
0
/ # php-fpm -tt
[global]
pid = undefined
error_log = /proc/self/fd/2
syslog.ident = php-fpm
syslog.facility = 24
log_buffering = yes
log_level = unknown value
log_limit = 8192
emergency_restart_interval = 0s
emergency_restart_threshold = 0
process_control_timeout = 0s
process.max = 0
process.priority = undefined
daemonize = no
rlimit_files = 0
rlimit_core = 0
events.mechanism = epoll
[www]
prefix = undefined
user = www-data
group = www-data
listen = 9000
listen.backlog = 511
listen.owner = undefined
listen.group = undefined
listen.mode = undefined
listen.allowed_clients = undefined
process.priority = undefined
process.dumpable = no
pm = dynamic
pm.max_children = 35
pm.start_servers = 6
pm.min_spare_servers = 4
pm.max_spare_servers = 8
pm.process_idle_timeout = 10
pm.max_requests = 500
pm.status_path = /_/php-fpm/status
ping.path = undefined
ping.response = undefined
access.log = /proc/self/fd/2
access.format = [%{%Y-%m-%dT%H:%M:%S%z}t] %R "%m %{REQUEST_SCHEME}e://%{HTTP_HOST}e%{REQUEST_URI}e" %s %f %{mili}d %{kilo}M %C%%
slowlog = undefined
request_slowlog_timeout = 0s
request_slowlog_trace_depth = 20
request_terminate_timeout = 0s
request_terminate_timeout_track_finished = no
rlimit_files = 0
rlimit_core = unlimited
chroot = undefined
chdir = undefined
catch_workers_output = yes
decorate_workers_output = no
clear_env = no
security.limit_extensions = .php .phar
configuration file /usr/local/etc/php-fpm.conf test is successful
I tried with /proc/sys/kernel/core_uses_pid
to 1
and with process.dumpable = yes
but core dumps are still not generated.
I suppose there is an issue with PHP-FPM config because when I execute a script in cli (I mean like php generate_sigsegv.php
) the core dump is well generated. However, I have no clues why things are going wrong.
For the CLI I use this script :
<?php
function segfault ($i = 1) {
echo "$i\n";
segfault($i + 1);
}
segfault();
?>
For PHP-FPM I am investigating a bug in my app so I have an API to call to generate SIGSEGV.
Upvotes: 0
Views: 4974
Reputation: 31
I met the problem too, and finally, I solved it by enable another setting in fpm pool conf.
process.dumpable = yes
rlimit_core = unlimited
NOTICE: Not only rlimit_core
should be set, But Also process.dumpable
.
Upvotes: 3
Reputation: 1
The issue was rights on folder where core dumps are generated. Ensure the user used by PHP-FPM has rights to write on the folder. Because PHP in CLI is executed with the user in your container (mainly root), you may have rights but not PHP-FPM.
Upvotes: 0