Download | Plain Text | Line Numbers


diff -Naur a/sapi/fpm/fpm/fpm_children.h b/sapi/fpm/fpm/fpm_children.h
--- a/sapi/fpm/fpm/fpm_children.h	2020-07-21 10:49:31.000000000 +0200
+++ b/sapi/fpm/fpm/fpm_children.h	2020-07-24 12:34:37.323835331 +0200
@@ -31,6 +31,7 @@
 	pid_t pid;
 	int scoreboard_i;
 	struct zlog_stream *log_stream;
+	int sigterm_sent;
 };
 
 #endif
diff -Naur a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c
--- a/sapi/fpm/fpm/fpm_process_ctl.c	2020-07-21 10:49:31.000000000 +0200
+++ b/sapi/fpm/fpm/fpm_process_ctl.c	2020-07-24 12:34:37.323835331 +0200
@@ -51,6 +51,7 @@
 
 static void fpm_pctl_action(struct fpm_event_s *ev, short which, void *arg) /* {{{ */
 {
+	ev->flags &= ~FPM_EV_PERSIST;
 	fpm_pctl(FPM_PCTL_STATE_UNSPECIFIED, FPM_PCTL_ACTION_TIMEOUT);
 }
 /* }}} */
@@ -59,6 +60,7 @@
 {
 	fpm_event_set_timer(&pctl_event, 0, &fpm_pctl_action, NULL);
 	fpm_event_add(&pctl_event, sec * 1000);
+	pctl_event.flags |= FPM_EV_PERSIST;
 	return 0;
 }
 /* }}} */
diff -Naur a/sapi/fpm/fpm/fpm_request.c b/sapi/fpm/fpm/fpm_request.c
--- a/sapi/fpm/fpm/fpm_request.c	2020-07-21 10:49:31.000000000 +0200
+++ b/sapi/fpm/fpm/fpm_request.c	2020-07-24 12:34:37.324835323 +0200
@@ -273,7 +273,8 @@
 #endif
 		if (terminate_timeout && tv.tv_sec >= terminate_timeout) {
 			str_purify_filename(purified_script_filename, proc.script_filename, sizeof(proc.script_filename));
-			fpm_pctl_kill(child->pid, FPM_PCTL_TERM);
+			fpm_pctl_kill(child->pid, (child->sigterm_sent) ? FPM_PCTL_KILL : FPM_PCTL_TERM);
+			child->sigterm_sent = 1;
 
 			zlog(ZLOG_WARNING, "[pool %s] child %d, script '%s' (request: \"%s %s%s%s\") execution timed out (%d.%06d sec), terminating",
 				child->wp->config->name, (int) child->pid, purified_script_filename, proc.request_method, proc.request_uri,