Bug #77430 [Asn]: php-fpm crashes with Main process exited, code=dumped, status=11/SEGV

From: Date: Tue, 15 Jan 2019 20:15:14 +0000
Subject: Bug #77430 [Asn]: php-fpm crashes with Main process exited, code=dumped, status=11/SEGV
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-218969@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77430&edit=1 ID: 77430 Updated by: bukka@php.net Reported by: claudiu_beta at yahoo dot com Summary: php-fpm crashes with Main process exited, code=dumped, status=11/SEGV Status: Assigned Type: Bug Package: FPM related Operating System: Fedora 28 PHP Version: 7.3.1RC1 Assigned To: bukka Block user comment: N Private report: N New Comment: I think that I know what the issue is. The event can be received after the child is freed which means that the shared log stream is uninitialized and it can't be used. Are you able to test the following patch: diff --git a/sapi/fpm/fpm/fpm_stdio.c b/sapi/fpm/fpm/fpm_stdio.c index ba8f6d8213..0ff189c9f0 100644 --- a/sapi/fpm/fpm/fpm_stdio.c +++ b/sapi/fpm/fpm/fpm_stdio.c @@ -196,8 +196,10 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg) } if (read_fail) { - zlog_stream_set_msg_suffix(log_stream, NULL, ", pipe is closed"); - zlog_stream_finish(log_stream); + if (!child->log_stream) { + zlog_stream_set_msg_suffix(log_stream, NULL, ", pipe is closed"); + zlog_stream_finish(log_stream); + } if (read_fail < 0) { zlog(ZLOG_SYSERROR, "unable to read what child say"); } Previous Comments: ------------------------------------------------------------------------ [2019-01-14 12:54:03] sjon at hortensius dot net I reported the exact same issue in 7.3.1 (as released) which NikiC tagged as a duplicate. There aren't necessarily any requests - according to the access-log, the last request was @ 03:43:35 and lasted 50ms (segfault @ 03:43:43). If you need more input let me know - I have a coredump on a debug-build ------------------------------------------------------------------------ [2019-01-14 09:21:24] claudiu_beta at yahoo dot com I have upgraded to Fedora 29 and php 7.3.1. This is a backtrace from a new coredump. #0 0x000055eb8b44fc73 in zlog_stream_set_msg_suffix (stream=stream@entry=0x100, suffix=suffix@entry=0x0, final_suffix=final_suffix@entry=0x55eb8b4aedf6 ", pipe is closed") at /usr/src/debug/php73-php-7.3.1-1.fc29.remi.x86_64/sapi/fpm/fpm/zlog.c:602 #1 0x000055eb8b44d109 in fpm_stdio_child_said (ev=<optimized out>, which=<optimized out>, arg=0x55eb8c536250) at /usr/src/debug/php73-php-7.3.1-1.fc29.remi.x86_64/sapi/fpm/fpm/fpm_stdio.c:199 #2 0x000055eb8b452596 in fpm_event_epoll_wait (queue=<optimized out>, timeout=<optimized out>) at /usr/src/debug/php73-php-7.3.1-1.fc29.remi.x86_64/sapi/fpm/fpm/events/epoll.c:145 #3 0x000055eb8b444e84 in fpm_event_loop (err=err@entry=0) at /usr/src/debug/php73-php-7.3.1-1.fc29.remi.x86_64/sapi/fpm/fpm/fpm_events.c:409 #4 0x000055eb8b43f217 in fpm_run (max_requests=0x7fff9540e34c) at /usr/src/debug/php73-php-7.3.1-1.fc29.remi.x86_64/sapi/fpm/fpm/fpm.c:113 #5 0x000055eb8b21c924 in main (argc=2, argv=0x7fff9540e968) at /usr/src/debug/php73-php-7.3.1-1.fc29.remi.x86_64/sapi/fpm/fpm/fpm_main.c:1864 ------------------------------------------------------------------------ [2019-01-14 09:05:09] nikic@php.net Related To: Bug #77455 ------------------------------------------------------------------------ [2019-01-09 19:47:33] bukka@php.net I guess it might be related to child restart possibly due request_terminate_timeout and not doing clean up properly but will need to verify it. Thanks for the config. ------------------------------------------------------------------------ [2019-01-09 06:48:46] claudiu_beta at yahoo dot com I'm using exactly the same templates for all 7.1,7.2,7.3 on few servers. I only have issues with 7.3. My monitoring script finds php73 service down several times a day, sometimes two or three times each hour. Maybe a coincidence, I don't know. Till RC6 I had no issues or, let say, just 1-2 issues a week (under 100 pools). After 7.3.0 GA, the number of issues increased a lot (number of pools per server on average 200-300). Different servers, different sites, the same issue. In logs I have no errors, nor "pipe is closed", nor anything else. I have checked the logs before and after the crash, nothing. With 7.2, for example, I have 1000+ pools on the same server with no crash issues. I have errors in logs like [07-Jan-2019 20:34:25] ERROR: unable to read what child say: Bad file descriptor (9) [07-Jan-2019 20:34:25] ERROR: unable to read what child say: Bad file descriptor (9) [07-Jan-2019 20:35:27] NOTICE: [pool poolname] child 23542 exited with code 0 after 69.601713 seconds from start [07-Jan-2019 20:35:27] NOTICE: [pool poolname] child 23797 started but service will not crash. php-fpm.conf include=/etc/opt/remi/php73/php-fpm.d/*.conf [global] pid = /var/opt/remi/php73/run/php-fpm/php-fpm.pid error_log = /var/log/php-fpm/master73.log syslog.ident = php-fpm73 daemonize = yes rlimit_files = 30000 and a pool [poolname] user = apache group = apache listen = /var/opt/remi/php73/run/php-fpm/pool.sock listen.acl_users = apache listen.allowed_clients = 127.0.0.1 pm = ondemand pm.max_children = 15 pm.process_idle_timeout = 4s pm.max_requests = 30 pm.status_path = /fpmstats slowlog = /var/log/php-fpm/00000_www-slow.log request_slowlog_timeout = 60 request_terminate_timeout = 63 chdir = /home/users/domain catch_workers_output = yes security.limit_extensions = .php .phtml .phar php_admin_value[mail.log] = /var/log/php-fpm/php_mail.log php_admin_value[mail.add_x_header] = On php_admin_value[error_log] = /var/log/php-fpm/domain.73.log php_admin_value[doc_root] = "/home/users/domain" php_admin_value[max_execution_time] = 60 php_admin_value[max_input_time] = 90 php_admin_value[max_input_vars] = 1000 php_admin_value[memory_limit] = 256M php_admin_value[post_max_size] = 10M php_admin_value[upload_max_filesize] = 10M php_admin_value[default_socket_timeout] = 30 php_admin_value[open_basedir] = /home/users/domain/:/tmp/:/usr/share/pear/ php_admin_value[disable_functions] = mail, mb_send_mail, system, exec, shell_exec, passthru, error_log, dl, sys_getloadavg, pfsockopen, openlog, syslog, readlink, symlink, link, leak, popen, escapeshellcmd ------------------------------------------------------------------------ The remainder of the comments for this report are too long. To view the rest of the comments, please view the bug report online at https://bugs.php.net/bug.php?id=77430 -- Edit this bug report at https://bugs.php.net/bug.php?id=77430&edit=1

« previous php.bugs (#218969) next »