Skip to content

Commit 766b4fd

Browse files
committed
Fix bug #77430 (php-fpm crashes with Main process exited)
1 parent 26b5aa8 commit 766b4fd

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

NEWS

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,10 @@ PHP NEWS
2121
. Fixed bug #77346 (webm files incorrectly detected as
2222
application/octet-stream). (Anatol)
2323

24+
- FPM:
25+
. Fixed bug #77430 (php-fpm crashes with Main process exited, code=dumped,
26+
status=11/SEGV). (Jakub Zelenka)
27+
2428
- GD:
2529
. Fixed bug #73281 (imagescale(…, IMG_BILINEAR_FIXED) can cause black border).
2630
(cmb)

sapi/fpm/fpm/fpm_stdio.c

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,7 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
122122
struct fpm_event_s *event;
123123
int fifo_in = 1, fifo_out = 1;
124124
int in_buf = 0;
125-
int read_fail = 0, finish_log_stream = 0;
125+
int read_fail = 0, finish_log_stream = 0, create_log_stream;
126126
int res;
127127
struct zlog_stream *log_stream;
128128

@@ -138,7 +138,8 @@ static void fpm_stdio_child_said(struct fpm_event_s *ev, short which, void *arg)
138138
event = &child->ev_stderr;
139139
}
140140

141-
if (!child->log_stream) {
141+
create_log_stream = !child->log_stream;
142+
if (create_log_stream) {
142143
log_stream = child->log_stream = malloc(sizeof(struct zlog_stream));
143144
zlog_stream_init_ex(log_stream, ZLOG_WARNING, STDERR_FILENO);
144145
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)
196197
}
197198

198199
if (read_fail) {
199-
zlog_stream_set_msg_suffix(log_stream, NULL, ", pipe is closed");
200-
zlog_stream_finish(log_stream);
200+
if (create_log_stream) {
201+
zlog_stream_set_msg_suffix(log_stream, NULL, ", pipe is closed");
202+
zlog_stream_finish(log_stream);
203+
}
201204
if (read_fail < 0) {
202205
zlog(ZLOG_SYSERROR, "unable to read what child say");
203206
}

0 commit comments

Comments
 (0)