Skip to content

Commit 5c68824

Browse files
committed
fpm: fix blocked signals while reloading
1 parent 64e8759 commit 5c68824

5 files changed

+14
-5
lines changed

sapi/fpm/fpm/fpm_process_ctl.c

+5-5
Original file line numberDiff line numberDiff line change
@@ -77,11 +77,6 @@ static void fpm_pctl_exit() /* {{{ */
7777

7878
static void fpm_pctl_exec() /* {{{ */
7979
{
80-
zlog(ZLOG_DEBUG, "Blocking some signals before reexec");
81-
if (0 > fpm_signals_block()) {
82-
zlog(ZLOG_WARNING, "concurrent reloads may be unstable");
83-
}
84-
8580
switch (fork()) {
8681
case 0:
8782
break;
@@ -109,6 +104,11 @@ static void fpm_pctl_exec() /* {{{ */
109104
optional_arg(10)
110105
);
111106

107+
zlog(ZLOG_DEBUG, "Blocking some signals before reexec");
108+
if (0 > fpm_signals_block()) {
109+
zlog(ZLOG_WARNING, "concurrent reloads may be unstable");
110+
}
111+
112112
fpm_cleanups_run(FPM_CLEANUP_PARENT_EXEC);
113113
execvp(saved_argv[0], saved_argv);
114114
zlog(ZLOG_SYSERROR, "failed to reload: execvp() failed");

sapi/fpm/tests/bug68442-signal-reload.phpt

+2
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,11 @@ $tester->ping('{{ADDR}}');
2929
$tester->signal('USR2');
3030
$tester->expectLogNotice('Reloading in progress ...');
3131
$tester->expectLogNotice('reloading: .*');
32+
$tester->expectLogNotice('exiting after reload');
3233
$tester->expectLogNotice('using inherited socket fd=\d+, "127.0.0.1:\d+"');
3334
$tester->expectLogStartNotices();
3435
$tester->ping('{{ADDR}}');
36+
$tester->signal('TERM');
3537
$tester->terminate();
3638
$tester->expectLogTerminatingNotices();
3739
$tester->close();

sapi/fpm/tests/bug74083-concurrent-reload.phpt

+2
Original file line numberDiff line numberDiff line change
@@ -57,10 +57,12 @@ $tester->getLogLines(2000);
5757
$tester->signal('USR2');
5858
$tester->expectLogNotice('Reloading in progress ...');
5959
$tester->expectLogNotice('reloading: .*');
60+
$tester->expectLogNotice('exiting after reload');
6061
$tester->expectLogNotice('using inherited socket fd=\d+, "127.0.0.1:\d+"');
6162
$tester->expectLogStartNotices();
6263
$tester->ping('{{ADDR}}');
6364

65+
$tester->signal('TERM');
6466
$tester->terminate();
6567
$tester->expectLogTerminatingNotices();
6668
$tester->close();

sapi/fpm/tests/bug76601-reload-child-signals.phpt

+2
Original file line numberDiff line numberDiff line change
@@ -73,9 +73,11 @@ if (!$tester->expectLogNotice('reloading: .*')) {
7373
echo "Skipped messages\n";
7474
echo implode('', $skipped);
7575
}
76+
$tester->expectLogNotice('exiting after reload');
7677
$tester->expectLogNotice('using inherited socket fd=\d+, "127.0.0.1:\d+"');
7778
$tester->expectLogStartNotices();
7879

80+
$tester->signal('TERM');
7981
$tester->terminate();
8082
$tester->expectLogTerminatingNotices();
8183
$tester->close();

sapi/fpm/tests/bug77934-reload-process-control.phpt

+3
Original file line numberDiff line numberDiff line change
@@ -30,9 +30,12 @@ $tester->ping('{{ADDR}}');
3030
$tester->signal('USR2');
3131
$tester->expectLogNotice('Reloading in progress ...');
3232
$tester->expectLogNotice('reloading: .*');
33+
$tester->expectLogNotice('exiting after reload');
3334
$tester->expectLogNotice('using inherited socket fd=\d+, "127.0.0.1:\d+"');
3435
$tester->expectLogStartNotices();
3536
$tester->ping('{{ADDR}}');
37+
38+
$tester->signal('TERM');
3639
$tester->terminate();
3740
$tester->expectLogTerminatingNotices();
3841
$tester->close();

0 commit comments

Comments
 (0)