]> granicus.if.org Git - php/commitdiff
Fix bug #77430 (php-fpm crashes with Main process exited)
authorJakub Zelenka <bukka@php.net>
Thu, 17 Jan 2019 18:33:53 +0000 (18:33 +0000)
committerJakub Zelenka <bukka@php.net>
Thu, 17 Jan 2019 18:37:09 +0000 (18:37 +0000)
NEWS
sapi/fpm/fpm/fpm_stdio.c

diff --git a/NEWS b/NEWS
index 8c78a69dba4256d0e0b7841caa34b465447d5000..c79de37e9cfa2abba6f18bfc00d5b019ce879418 100644 (file)
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,10 @@ PHP                                                                        NEWS
   . Fixed bug #77346 (webm files incorrectly detected as
     application/octet-stream). (Anatol)
 
+- FPM:
+  . Fixed bug #77430 (php-fpm crashes with Main process exited, code=dumped,
+    status=11/SEGV). (Jakub Zelenka)
+
 - GD:
   . Fixed bug #73281 (imagescale(…, IMG_BILINEAR_FIXED) can cause black border).
     (cmb)
index ba8f6d821300fab28328533d570c59d97b64b6bf..03d15cbf0d7cafbb0da1cb543956c91bc6c65e97 100644 (file)
@@ -122,7 +122,7 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
        struct fpm_event_s *event;
        int fifo_in = 1, fifo_out = 1;
        int in_buf = 0;
-       int read_fail = 0, finish_log_stream = 0;
+       int read_fail = 0, finish_log_stream = 0, create_log_stream;
        int res;
        struct zlog_stream *log_stream;
 
@@ -138,7 +138,8 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
                event = &child->ev_stderr;
        }
 
-       if (!child->log_stream) {
+       create_log_stream = !child->log_stream;
+       if (create_log_stream) {
                log_stream = child->log_stream = malloc(sizeof(struct zlog_stream));
                zlog_stream_init_ex(log_stream, ZLOG_WARNING, STDERR_FILENO);
                zlog_stream_set_decorating(log_stream, child->wp->config->decorate_workers_output);
@@ -196,8 +197,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 (create_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");
                }