php-fpm: add upstream patch for startup issue (#846858)
This commit is contained in:
parent
2aecdb0951
commit
b97abaf408
1
.gitignore
vendored
1
.gitignore
vendored
@ -1,4 +1,5 @@
|
|||||||
php.spec~
|
php.spec~
|
||||||
|
php-5.3*.bz2
|
||||||
/php-5.4.4.tar.bz2
|
/php-5.4.4.tar.bz2
|
||||||
/php-5.4.5.tar.bz2
|
/php-5.4.5.tar.bz2
|
||||||
/php-5.4.6.tar.bz2
|
/php-5.4.6.tar.bz2
|
||||||
|
@ -1,6 +1,24 @@
|
|||||||
diff -Nru sapi/fpm.old/config.m4 sapi/fpm/config.m4
|
From 851a04bb7b680954249e825ea3fef420f7d66bb7 Mon Sep 17 00:00:00 2001
|
||||||
--- sapi/fpm.old/config.m4 2012-09-19 15:53:48.001758347 +0200
|
From: Jerome Loyet <fat@php.net>
|
||||||
+++ sapi/fpm/config.m4 2012-09-19 16:18:57.661936394 +0200
|
Date: Fri, 28 Sep 2012 00:33:05 +0200
|
||||||
|
Subject: [PATCH] - Fixed bug #63085 (Systemd integration and daemonize)
|
||||||
|
|
||||||
|
---
|
||||||
|
NEWS | 1 +
|
||||||
|
sapi/fpm/config.m4 | 2 +-
|
||||||
|
sapi/fpm/fpm/fpm.c | 4 ++--
|
||||||
|
sapi/fpm/fpm/fpm.h | 2 +-
|
||||||
|
sapi/fpm/fpm/fpm_conf.c | 11 ++++++++---
|
||||||
|
sapi/fpm/fpm/fpm_conf.h | 2 +-
|
||||||
|
sapi/fpm/fpm/fpm_main.c | 18 ++++++++++++++++--
|
||||||
|
sapi/fpm/init.d.php-fpm.in | 2 +-
|
||||||
|
sapi/fpm/php-fpm.8.in | 23 ++++++++++++++++++++++-
|
||||||
|
9 files changed, 53 insertions(+), 12 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sapi/fpm/config.m4 b/sapi/fpm/config.m4
|
||||||
|
index c23485a..7687660 100644
|
||||||
|
--- a/sapi/fpm/config.m4
|
||||||
|
+++ b/sapi/fpm/config.m4
|
||||||
@@ -589,7 +589,7 @@
|
@@ -589,7 +589,7 @@
|
||||||
|
|
||||||
PHP_ADD_BUILD_DIR(sapi/fpm/fpm)
|
PHP_ADD_BUILD_DIR(sapi/fpm/fpm)
|
||||||
@ -10,11 +28,12 @@ diff -Nru sapi/fpm.old/config.m4 sapi/fpm/config.m4
|
|||||||
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag])
|
PHP_ADD_MAKEFILE_FRAGMENT([$abs_srcdir/sapi/fpm/Makefile.frag])
|
||||||
|
|
||||||
SAPI_FPM_PATH=sapi/fpm/php-fpm
|
SAPI_FPM_PATH=sapi/fpm/php-fpm
|
||||||
diff -Nru sapi/fpm.old/fpm/fpm.c sapi/fpm/fpm/fpm.c
|
diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c
|
||||||
--- sapi/fpm.old/fpm/fpm.c 2012-09-19 15:53:48.000758297 +0200
|
index 2f42175..b866f37 100644
|
||||||
+++ sapi/fpm/fpm/fpm.c 2012-09-19 16:09:57.462102346 +0200
|
--- a/sapi/fpm/fpm/fpm.c
|
||||||
@@ -42,7 +42,7 @@
|
+++ b/sapi/fpm/fpm/fpm.c
|
||||||
.send_config_signal = 0,
|
@@ -42,7 +42,7 @@ struct fpm_globals_s fpm_globals = {
|
||||||
|
.send_config_pipe = {0, 0},
|
||||||
};
|
};
|
||||||
|
|
||||||
-int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */
|
-int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */
|
||||||
@ -22,7 +41,7 @@ diff -Nru sapi/fpm.old/fpm/fpm.c sapi/fpm/fpm/fpm.c
|
|||||||
{
|
{
|
||||||
fpm_globals.argc = argc;
|
fpm_globals.argc = argc;
|
||||||
fpm_globals.argv = argv;
|
fpm_globals.argv = argv;
|
||||||
@@ -55,7 +55,7 @@
|
@@ -55,7 +55,7 @@ int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int t
|
||||||
|
|
||||||
if (0 > fpm_php_init_main() ||
|
if (0 > fpm_php_init_main() ||
|
||||||
0 > fpm_stdio_init_main() ||
|
0 > fpm_stdio_init_main() ||
|
||||||
@ -31,10 +50,24 @@ diff -Nru sapi/fpm.old/fpm/fpm.c sapi/fpm/fpm/fpm.c
|
|||||||
0 > fpm_unix_init_main() ||
|
0 > fpm_unix_init_main() ||
|
||||||
0 > fpm_scoreboard_init_main() ||
|
0 > fpm_scoreboard_init_main() ||
|
||||||
0 > fpm_pctl_init_main() ||
|
0 > fpm_pctl_init_main() ||
|
||||||
diff -Nru sapi/fpm.old/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.c
|
diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h
|
||||||
--- sapi/fpm.old/fpm/fpm_conf.c 2012-09-19 15:53:48.000758297 +0200
|
index c576876..65d0e0d 100644
|
||||||
+++ sapi/fpm/fpm/fpm_conf.c 2012-09-19 16:08:46.034854345 +0200
|
--- a/sapi/fpm/fpm/fpm.h
|
||||||
@@ -1115,7 +1115,7 @@
|
+++ b/sapi/fpm/fpm/fpm.h
|
||||||
|
@@ -37,7 +37,7 @@
|
||||||
|
|
||||||
|
|
||||||
|
int fpm_run(int *max_requests);
|
||||||
|
-int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root);
|
||||||
|
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon);
|
||||||
|
|
||||||
|
struct fpm_globals_s {
|
||||||
|
pid_t parent_pid;
|
||||||
|
diff --git a/sapi/fpm/fpm/fpm_conf.c b/sapi/fpm/fpm/fpm_conf.c
|
||||||
|
index dfe6792..25e2cc4 100644
|
||||||
|
--- a/sapi/fpm/fpm/fpm_conf.c
|
||||||
|
+++ b/sapi/fpm/fpm/fpm_conf.c
|
||||||
|
@@ -1115,7 +1115,7 @@ int fpm_conf_write_pid() /* {{{ */
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@ -43,7 +76,7 @@ diff -Nru sapi/fpm.old/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.c
|
|||||||
{
|
{
|
||||||
struct fpm_worker_pool_s *wp;
|
struct fpm_worker_pool_s *wp;
|
||||||
|
|
||||||
@@ -1123,6 +1123,11 @@
|
@@ -1123,6 +1123,11 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */
|
||||||
fpm_evaluate_full_path(&fpm_global_config.pid_file, NULL, PHP_LOCALSTATEDIR, 0);
|
fpm_evaluate_full_path(&fpm_global_config.pid_file, NULL, PHP_LOCALSTATEDIR, 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -55,7 +88,7 @@ diff -Nru sapi/fpm.old/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.c
|
|||||||
fpm_globals.log_level = fpm_global_config.log_level;
|
fpm_globals.log_level = fpm_global_config.log_level;
|
||||||
|
|
||||||
if (fpm_global_config.process_max < 0) {
|
if (fpm_global_config.process_max < 0) {
|
||||||
@@ -1584,7 +1589,7 @@
|
@@ -1584,7 +1589,7 @@ static void fpm_conf_dump() /* {{{ */
|
||||||
}
|
}
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
@ -64,7 +97,7 @@ diff -Nru sapi/fpm.old/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.c
|
|||||||
{
|
{
|
||||||
int ret;
|
int ret;
|
||||||
TSRMLS_FETCH();
|
TSRMLS_FETCH();
|
||||||
@@ -1630,7 +1635,7 @@
|
@@ -1630,7 +1635,7 @@ int fpm_conf_init_main(int test_conf) /* {{{ */
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -73,10 +106,11 @@ diff -Nru sapi/fpm.old/fpm/fpm_conf.c sapi/fpm/fpm/fpm_conf.c
|
|||||||
zlog(ZLOG_ERROR, "failed to post process the configuration");
|
zlog(ZLOG_ERROR, "failed to post process the configuration");
|
||||||
return -1;
|
return -1;
|
||||||
}
|
}
|
||||||
diff -Nru sapi/fpm.old/fpm/fpm_conf.h sapi/fpm/fpm/fpm_conf.h
|
diff --git a/sapi/fpm/fpm/fpm_conf.h b/sapi/fpm/fpm/fpm_conf.h
|
||||||
--- sapi/fpm.old/fpm/fpm_conf.h 2012-09-19 15:53:48.000758297 +0200
|
index f780f03..dc54133 100644
|
||||||
+++ sapi/fpm/fpm/fpm_conf.h 2012-09-19 16:05:29.874174589 +0200
|
--- a/sapi/fpm/fpm/fpm_conf.h
|
||||||
@@ -97,7 +97,7 @@
|
+++ b/sapi/fpm/fpm/fpm_conf.h
|
||||||
|
@@ -97,7 +97,7 @@ enum {
|
||||||
PM_STYLE_ONDEMAND = 3
|
PM_STYLE_ONDEMAND = 3
|
||||||
};
|
};
|
||||||
|
|
||||||
@ -85,21 +119,10 @@ diff -Nru sapi/fpm.old/fpm/fpm_conf.h sapi/fpm/fpm/fpm_conf.h
|
|||||||
int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc);
|
int fpm_worker_pool_config_free(struct fpm_worker_pool_config_s *wpc);
|
||||||
int fpm_conf_write_pid();
|
int fpm_conf_write_pid();
|
||||||
int fpm_conf_unlink_pid();
|
int fpm_conf_unlink_pid();
|
||||||
diff -Nru sapi/fpm.old/fpm/fpm.h sapi/fpm/fpm/fpm.h
|
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
|
||||||
--- sapi/fpm.old/fpm/fpm.h 2012-09-19 15:53:48.000758297 +0200
|
index 70e917a..3faf308 100644
|
||||||
+++ sapi/fpm/fpm/fpm.h 2012-09-19 16:02:06.113470905 +0200
|
--- a/sapi/fpm/fpm/fpm_main.c
|
||||||
@@ -37,7 +37,7 @@
|
+++ b/sapi/fpm/fpm/fpm_main.c
|
||||||
|
|
||||||
|
|
||||||
int fpm_run(int *max_requests);
|
|
||||||
-int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root);
|
|
||||||
+int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root, int force_daemon);
|
|
||||||
|
|
||||||
struct fpm_globals_s {
|
|
||||||
pid_t parent_pid;
|
|
||||||
diff -Nru sapi/fpm.old/fpm/fpm_main.c sapi/fpm/fpm/fpm_main.c
|
|
||||||
--- sapi/fpm.old/fpm/fpm_main.c 2012-09-19 15:53:47.999758244 +0200
|
|
||||||
+++ sapi/fpm/fpm/fpm_main.c 2012-09-19 16:29:52.595853439 +0200
|
|
||||||
@@ -155,6 +155,8 @@
|
@@ -155,6 +155,8 @@
|
||||||
{'p', 1, "prefix"},
|
{'p', 1, "prefix"},
|
||||||
{'g', 1, "pid"},
|
{'g', 1, "pid"},
|
||||||
@ -123,7 +146,7 @@ diff -Nru sapi/fpm.old/fpm/fpm_main.c sapi/fpm/fpm/fpm_main.c
|
|||||||
" Specify alternative path to FastCGI process manager config file.\n"
|
" Specify alternative path to FastCGI process manager config file.\n"
|
||||||
" -t, --test Test FPM configuration and exit\n"
|
" -t, --test Test FPM configuration and exit\n"
|
||||||
+ " -D, --daemonize force to run in background, and ignore daemonize option from config file\n"
|
+ " -D, --daemonize force to run in background, and ignore daemonize option from config file\n"
|
||||||
+ " F, --nodaemonize\n"
|
+ " -F, --nodaemonize\n"
|
||||||
+ " force to stay in foreground, and ignore daemonize option from config file\n"
|
+ " force to stay in foreground, and ignore daemonize option from config file\n"
|
||||||
" -R, --allow-to-run-as-root\n"
|
" -R, --allow-to-run-as-root\n"
|
||||||
" Allow pool to run as root (disabled by default)\n",
|
" Allow pool to run as root (disabled by default)\n",
|
||||||
@ -158,12 +181,13 @@ diff -Nru sapi/fpm.old/fpm/fpm_main.c sapi/fpm/fpm/fpm_main.c
|
|||||||
- if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root)) {
|
- if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root)) {
|
||||||
+ if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root, force_daemon)) {
|
+ if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root, force_daemon)) {
|
||||||
|
|
||||||
if (fpm_globals.send_config_signal) {
|
if (fpm_globals.send_config_pipe[1]) {
|
||||||
zlog(ZLOG_DEBUG, "Sending SIGUSR2 (error) to parent %d", getppid());
|
int writeval = 0;
|
||||||
diff -Nru sapi/fpm.old/init.d.php-fpm.in sapi/fpm/init.d.php-fpm.in
|
diff --git a/sapi/fpm/init.d.php-fpm.in b/sapi/fpm/init.d.php-fpm.in
|
||||||
--- sapi/fpm.old/init.d.php-fpm.in 2012-09-19 15:53:47.998758183 +0200
|
index dc66310..3edd64f 100644
|
||||||
+++ sapi/fpm/init.d.php-fpm.in 2012-09-19 16:12:13.356570094 +0200
|
--- a/sapi/fpm/init.d.php-fpm.in
|
||||||
@@ -54,7 +54,7 @@
|
+++ b/sapi/fpm/init.d.php-fpm.in
|
||||||
|
@@ -54,7 +54,7 @@ case "$1" in
|
||||||
start)
|
start)
|
||||||
echo -n "Starting php-fpm "
|
echo -n "Starting php-fpm "
|
||||||
|
|
||||||
@ -172,10 +196,11 @@ diff -Nru sapi/fpm.old/init.d.php-fpm.in sapi/fpm/init.d.php-fpm.in
|
|||||||
|
|
||||||
if [ "$?" != 0 ] ; then
|
if [ "$?" != 0 ] ; then
|
||||||
echo " failed"
|
echo " failed"
|
||||||
diff -Nru sapi/fpm.old/php-fpm.8.in sapi/fpm/php-fpm.8.in
|
diff --git a/sapi/fpm/php-fpm.8.in b/sapi/fpm/php-fpm.8.in
|
||||||
--- sapi/fpm.old/php-fpm.8.in 2012-09-19 15:53:47.998758183 +0200
|
index 6c9c6d6..a4e7e74 100644
|
||||||
+++ sapi/fpm/php-fpm.8.in 2012-09-19 16:40:57.865863325 +0200
|
--- a/sapi/fpm/php-fpm.8.in
|
||||||
@@ -99,6 +99,20 @@
|
+++ b/sapi/fpm/php-fpm.8.in
|
||||||
|
@@ -99,6 +99,20 @@ Test FPM configuration file and exit
|
||||||
If called twice (-tt), the configuration is dumped before exiting.
|
If called twice (-tt), the configuration is dumped before exiting.
|
||||||
.TP
|
.TP
|
||||||
.PD 0
|
.PD 0
|
||||||
@ -196,7 +221,7 @@ diff -Nru sapi/fpm.old/php-fpm.8.in sapi/fpm/php-fpm.8.in
|
|||||||
.B \-\-zend\-extension \fIfile\fP
|
.B \-\-zend\-extension \fIfile\fP
|
||||||
.TP
|
.TP
|
||||||
.PD 1
|
.PD 1
|
||||||
@@ -113,13 +127,20 @@
|
@@ -113,13 +127,20 @@ The configuration file for the php-fpm daemon.
|
||||||
.B php.ini
|
.B php.ini
|
||||||
The standard php configuration file.
|
The standard php configuration file.
|
||||||
.SH EXAMPLES
|
.SH EXAMPLES
|
||||||
@ -218,9 +243,24 @@ diff -Nru sapi/fpm.old/php-fpm.8.in sapi/fpm/php-fpm.8.in
|
|||||||
If your installation has no appropriate init script, launch php-fpm with no arguments. It will launch as a daemon (background process) by default. The file @php_fpm_localstatedir@/run/php-fpm.pid determines whether php-fpm is already up and running. Once started, php-fpm then responds to several POSIX signals:
|
If your installation has no appropriate init script, launch php-fpm with no arguments. It will launch as a daemon (background process) by default. The file @php_fpm_localstatedir@/run/php-fpm.pid determines whether php-fpm is already up and running. Once started, php-fpm then responds to several POSIX signals:
|
||||||
.P
|
.P
|
||||||
.PD 0
|
.PD 0
|
||||||
diff -Nru sapi/fpm.old/php-fpm.service.in sapi/fpm/php-fpm.service.in
|
--
|
||||||
--- sapi/fpm.old/php-fpm.service.in 1970-01-01 01:00:00.000000000 +0100
|
1.7.8
|
||||||
+++ sapi/fpm/php-fpm.service.in 2012-09-19 16:21:32.140467558 +0200
|
|
||||||
|
From 2259a8f18b1f25c175c486f54849fcd9e61ecde1 Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jerome Loyet <fat@php.net>
|
||||||
|
Date: Fri, 28 Sep 2012 00:47:56 +0200
|
||||||
|
Subject: [PATCH] - add missing php-fpm.service.in
|
||||||
|
|
||||||
|
---
|
||||||
|
sapi/fpm/php-fpm.service.in | 12 ++++++++++++
|
||||||
|
1 files changed, 12 insertions(+), 0 deletions(-)
|
||||||
|
create mode 100644 sapi/fpm/php-fpm.service.in
|
||||||
|
|
||||||
|
diff --git a/sapi/fpm/php-fpm.service.in b/sapi/fpm/php-fpm.service.in
|
||||||
|
new file mode 100644
|
||||||
|
index 0000000..396a88d
|
||||||
|
--- /dev/null
|
||||||
|
+++ b/sapi/fpm/php-fpm.service.in
|
||||||
@@ -0,0 +1,12 @@
|
@@ -0,0 +1,12 @@
|
||||||
+[Unit]
|
+[Unit]
|
||||||
+Description=The PHP FastCGI Process Manager
|
+Description=The PHP FastCGI Process Manager
|
||||||
@ -234,3 +274,6 @@ diff -Nru sapi/fpm.old/php-fpm.service.in sapi/fpm/php-fpm.service.in
|
|||||||
+[Install]
|
+[Install]
|
||||||
+WantedBy=multi-user.target
|
+WantedBy=multi-user.target
|
||||||
+
|
+
|
||||||
|
--
|
||||||
|
1.7.8
|
||||||
|
|
223
php-5.4.7-fpm.patch
Normal file
223
php-5.4.7-fpm.patch
Normal file
@ -0,0 +1,223 @@
|
|||||||
|
From b5eb1456aa17e83b7b734dfc2316d632c9adcc6c Mon Sep 17 00:00:00 2001
|
||||||
|
From: Jerome Loyet <fat@php.net>
|
||||||
|
Date: Fri, 28 Sep 2012 00:05:48 +0200
|
||||||
|
Subject: [PATCH] - Fixed bug #62954 (startup problems fpm / php-fpm) - Fixed
|
||||||
|
bug #62886 (PHP-FPM may segfault/hang on startup)
|
||||||
|
|
||||||
|
---
|
||||||
|
NEWS | 4 ++
|
||||||
|
sapi/fpm/fpm/fpm.c | 2 +-
|
||||||
|
sapi/fpm/fpm/fpm.h | 2 +-
|
||||||
|
sapi/fpm/fpm/fpm_main.c | 16 +++++---
|
||||||
|
sapi/fpm/fpm/fpm_signals.c | 12 ------
|
||||||
|
sapi/fpm/fpm/fpm_signals.h | 3 --
|
||||||
|
sapi/fpm/fpm/fpm_unix.c | 81 +++++++++++++++++++++++++------------------
|
||||||
|
7 files changed, 63 insertions(+), 57 deletions(-)
|
||||||
|
|
||||||
|
diff --git a/sapi/fpm/fpm/fpm.c b/sapi/fpm/fpm/fpm.c
|
||||||
|
index dab415d..2f42175 100644
|
||||||
|
--- a/sapi/fpm/fpm/fpm.c
|
||||||
|
+++ b/sapi/fpm/fpm/fpm.c
|
||||||
|
@@ -39,7 +39,7 @@ struct fpm_globals_s fpm_globals = {
|
||||||
|
.test_successful = 0,
|
||||||
|
.heartbeat = 0,
|
||||||
|
.run_as_root = 0,
|
||||||
|
- .send_config_signal = 0,
|
||||||
|
+ .send_config_pipe = {0, 0},
|
||||||
|
};
|
||||||
|
|
||||||
|
int fpm_init(int argc, char **argv, char *config, char *prefix, char *pid, int test_conf, int run_as_root) /* {{{ */
|
||||||
|
diff --git a/sapi/fpm/fpm/fpm.h b/sapi/fpm/fpm/fpm.h
|
||||||
|
index 7a2903d..c576876 100644
|
||||||
|
--- a/sapi/fpm/fpm/fpm.h
|
||||||
|
+++ b/sapi/fpm/fpm/fpm.h
|
||||||
|
@@ -55,7 +55,7 @@ struct fpm_globals_s {
|
||||||
|
int test_successful;
|
||||||
|
int heartbeat;
|
||||||
|
int run_as_root;
|
||||||
|
- int send_config_signal;
|
||||||
|
+ int send_config_pipe[2];
|
||||||
|
};
|
||||||
|
|
||||||
|
extern struct fpm_globals_s fpm_globals;
|
||||||
|
diff --git a/sapi/fpm/fpm/fpm_main.c b/sapi/fpm/fpm/fpm_main.c
|
||||||
|
index cdec235..925cbc1 100644
|
||||||
|
--- a/sapi/fpm/fpm/fpm_main.c
|
||||||
|
+++ b/sapi/fpm/fpm/fpm_main.c
|
||||||
|
@@ -1799,16 +1799,20 @@ consult the installation file that came with this distribution, or visit \n\
|
||||||
|
|
||||||
|
if (0 > fpm_init(argc, argv, fpm_config ? fpm_config : CGIG(fpm_config), fpm_prefix, fpm_pid, test_conf, php_allow_to_run_as_root)) {
|
||||||
|
|
||||||
|
- if (fpm_globals.send_config_signal) {
|
||||||
|
- zlog(ZLOG_DEBUG, "Sending SIGUSR2 (error) to parent %d", getppid());
|
||||||
|
- kill(getppid(), SIGUSR2);
|
||||||
|
+ if (fpm_globals.send_config_pipe[1]) {
|
||||||
|
+ int writeval = 0;
|
||||||
|
+ zlog(ZLOG_DEBUG, "Sending \"0\" (error) to parent via fd=%d", fpm_globals.send_config_pipe[1]);
|
||||||
|
+ write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval));
|
||||||
|
+ close(fpm_globals.send_config_pipe[1]);
|
||||||
|
}
|
||||||
|
return FPM_EXIT_CONFIG;
|
||||||
|
}
|
||||||
|
|
||||||
|
- if (fpm_globals.send_config_signal) {
|
||||||
|
- zlog(ZLOG_DEBUG, "Sending SIGUSR1 (OK) to parent %d", getppid());
|
||||||
|
- kill(getppid(), SIGUSR1);
|
||||||
|
+ if (fpm_globals.send_config_pipe[1]) {
|
||||||
|
+ int writeval = 1;
|
||||||
|
+ zlog(ZLOG_DEBUG, "Sending \"1\" (OK) to parent via fd=%d", fpm_globals.send_config_pipe[1]);
|
||||||
|
+ write(fpm_globals.send_config_pipe[1], &writeval, sizeof(writeval));
|
||||||
|
+ close(fpm_globals.send_config_pipe[1]);
|
||||||
|
}
|
||||||
|
fpm_is_running = 1;
|
||||||
|
|
||||||
|
diff --git a/sapi/fpm/fpm/fpm_signals.c b/sapi/fpm/fpm/fpm_signals.c
|
||||||
|
index 656269f..8993a86 100644
|
||||||
|
--- a/sapi/fpm/fpm/fpm_signals.c
|
||||||
|
+++ b/sapi/fpm/fpm/fpm_signals.c
|
||||||
|
@@ -249,15 +249,3 @@ int fpm_signals_get_fd() /* {{{ */
|
||||||
|
}
|
||||||
|
/* }}} */
|
||||||
|
|
||||||
|
-void fpm_signals_sighandler_exit_ok(pid_t pid) /* {{{ */
|
||||||
|
-{
|
||||||
|
- exit(FPM_EXIT_OK);
|
||||||
|
-}
|
||||||
|
-/* }}} */
|
||||||
|
-
|
||||||
|
-void fpm_signals_sighandler_exit_config(pid_t pid) /* {{{ */
|
||||||
|
-{
|
||||||
|
- exit(FPM_EXIT_CONFIG);
|
||||||
|
-}
|
||||||
|
-/* }}} */
|
||||||
|
-
|
||||||
|
diff --git a/sapi/fpm/fpm/fpm_signals.h b/sapi/fpm/fpm/fpm_signals.h
|
||||||
|
index 13484cb..eb80fae 100644
|
||||||
|
--- a/sapi/fpm/fpm/fpm_signals.h
|
||||||
|
+++ b/sapi/fpm/fpm/fpm_signals.h
|
||||||
|
@@ -11,9 +11,6 @@ int fpm_signals_init_main();
|
||||||
|
int fpm_signals_init_child();
|
||||||
|
int fpm_signals_get_fd();
|
||||||
|
|
||||||
|
-void fpm_signals_sighandler_exit_ok(pid_t pid);
|
||||||
|
-void fpm_signals_sighandler_exit_config(pid_t pid);
|
||||||
|
-
|
||||||
|
extern const char *fpm_signal_names[NSIG + 1];
|
||||||
|
|
||||||
|
#endif
|
||||||
|
diff --git a/sapi/fpm/fpm/fpm_unix.c b/sapi/fpm/fpm/fpm_unix.c
|
||||||
|
index 5c5e37c..1a75944 100644
|
||||||
|
--- a/sapi/fpm/fpm/fpm_unix.c
|
||||||
|
+++ b/sapi/fpm/fpm/fpm_unix.c
|
||||||
|
@@ -262,36 +262,19 @@ int fpm_unix_init_main() /* {{{ */
|
||||||
|
* The parent process has then to wait for the master
|
||||||
|
* process to initialize to return a consistent exit
|
||||||
|
* value. For this pupose, the master process will
|
||||||
|
- * send USR1 if everything went well and USR2
|
||||||
|
- * otherwise.
|
||||||
|
+ * send \"1\" into the pipe if everything went well
|
||||||
|
+ * and \"0\" otherwise.
|
||||||
|
*/
|
||||||
|
|
||||||
|
- struct sigaction act;
|
||||||
|
- struct sigaction oldact_usr1;
|
||||||
|
- struct sigaction oldact_usr2;
|
||||||
|
- struct timeval tv;
|
||||||
|
|
||||||
|
- /*
|
||||||
|
- * set sigaction for USR1 before fork
|
||||||
|
- * save old sigaction to restore it after
|
||||||
|
- * fork in the child process (the master process)
|
||||||
|
- */
|
||||||
|
- memset(&act, 0, sizeof(act));
|
||||||
|
- memset(&act, 0, sizeof(oldact_usr1));
|
||||||
|
- act.sa_handler = fpm_signals_sighandler_exit_ok;
|
||||||
|
- sigfillset(&act.sa_mask);
|
||||||
|
- sigaction(SIGUSR1, &act, &oldact_usr1);
|
||||||
|
+ struct timeval tv;
|
||||||
|
+ fd_set rfds;
|
||||||
|
+ int ret;
|
||||||
|
|
||||||
|
- /*
|
||||||
|
- * set sigaction for USR2 before fork
|
||||||
|
- * save old sigaction to restore it after
|
||||||
|
- * fork in the child process (the master process)
|
||||||
|
- */
|
||||||
|
- memset(&act, 0, sizeof(act));
|
||||||
|
- memset(&act, 0, sizeof(oldact_usr2));
|
||||||
|
- act.sa_handler = fpm_signals_sighandler_exit_config;
|
||||||
|
- sigfillset(&act.sa_mask);
|
||||||
|
- sigaction(SIGUSR2, &act, &oldact_usr2);
|
||||||
|
+ if (pipe(fpm_globals.send_config_pipe) == -1) {
|
||||||
|
+ zlog(ZLOG_SYSERROR, "failed to create pipe");
|
||||||
|
+ return -1;
|
||||||
|
+ }
|
||||||
|
|
||||||
|
/* then fork */
|
||||||
|
pid_t pid = fork();
|
||||||
|
@@ -302,24 +285,54 @@ int fpm_unix_init_main() /* {{{ */
|
||||||
|
return -1;
|
||||||
|
|
||||||
|
case 0 : /* children */
|
||||||
|
- /* restore USR1 and USR2 sigaction */
|
||||||
|
- sigaction(SIGUSR1, &oldact_usr1, NULL);
|
||||||
|
- sigaction(SIGUSR2, &oldact_usr2, NULL);
|
||||||
|
- fpm_globals.send_config_signal = 1;
|
||||||
|
+ close(fpm_globals.send_config_pipe[0]); /* close the read side of the pipe */
|
||||||
|
break;
|
||||||
|
|
||||||
|
default : /* parent */
|
||||||
|
- fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT);
|
||||||
|
+ close(fpm_globals.send_config_pipe[1]); /* close the write side of the pipe */
|
||||||
|
|
||||||
|
/*
|
||||||
|
* wait for 10s before exiting with error
|
||||||
|
- * the child is supposed to send USR1 or USR2 to tell the parent
|
||||||
|
+ * the child is supposed to send 1 or 0 into the pipe to tell the parent
|
||||||
|
* how it goes for it
|
||||||
|
*/
|
||||||
|
+ FD_ZERO(&rfds);
|
||||||
|
+ FD_SET(fpm_globals.send_config_pipe[0], &rfds);
|
||||||
|
+
|
||||||
|
tv.tv_sec = 10;
|
||||||
|
tv.tv_usec = 0;
|
||||||
|
- zlog(ZLOG_DEBUG, "The calling process is waiting for the master process to ping");
|
||||||
|
- select(0, NULL, NULL, NULL, &tv);
|
||||||
|
+
|
||||||
|
+ zlog(ZLOG_DEBUG, "The calling process is waiting for the master process to ping via fd=%d", fpm_globals.send_config_pipe[0]);
|
||||||
|
+ ret = select(fpm_globals.send_config_pipe[0] + 1, &rfds, NULL, NULL, &tv);
|
||||||
|
+ if (ret == -1) {
|
||||||
|
+ zlog(ZLOG_SYSERROR, "failed to select");
|
||||||
|
+ exit(FPM_EXIT_SOFTWARE);
|
||||||
|
+ }
|
||||||
|
+ if (ret) { /* data available */
|
||||||
|
+ int readval;
|
||||||
|
+ ret = read(fpm_globals.send_config_pipe[0], &readval, sizeof(readval));
|
||||||
|
+ if (ret == -1) {
|
||||||
|
+ zlog(ZLOG_SYSERROR, "failed to read from pipe");
|
||||||
|
+ exit(FPM_EXIT_SOFTWARE);
|
||||||
|
+ }
|
||||||
|
+
|
||||||
|
+ if (ret == 0) {
|
||||||
|
+ zlog(ZLOG_ERROR, "no data have been read from pipe");
|
||||||
|
+ exit(FPM_EXIT_SOFTWARE);
|
||||||
|
+ } else {
|
||||||
|
+ if (readval == 1) {
|
||||||
|
+ zlog(ZLOG_DEBUG, "I received a valid acknoledge from the master process, I can exit without error");
|
||||||
|
+ fpm_cleanups_run(FPM_CLEANUP_PARENT_EXIT);
|
||||||
|
+ exit(FPM_EXIT_OK);
|
||||||
|
+ } else {
|
||||||
|
+ zlog(ZLOG_DEBUG, "The master process returned an error !");
|
||||||
|
+ exit(FPM_EXIT_SOFTWARE);
|
||||||
|
+ }
|
||||||
|
+ }
|
||||||
|
+ } else { /* no date sent ! */
|
||||||
|
+ zlog(ZLOG_ERROR, "the master process didn't send back its status (via the pipe to the calling process)");
|
||||||
|
+ exit(FPM_EXIT_SOFTWARE);
|
||||||
|
+ }
|
||||||
|
exit(FPM_EXIT_SOFTWARE);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
--
|
||||||
|
1.7.8
|
||||||
|
|
8
php.spec
8
php.spec
@ -80,6 +80,8 @@ Patch20: php-5.4.7-imap.patch
|
|||||||
Patch21: php-5.4.7-odbctimer.patch
|
Patch21: php-5.4.7-odbctimer.patch
|
||||||
# https://bugs.php.net/63149 check sqlite3_column_table_name
|
# https://bugs.php.net/63149 check sqlite3_column_table_name
|
||||||
Patch22: php-5.4.7-sqlite.patch
|
Patch22: php-5.4.7-sqlite.patch
|
||||||
|
# https://bugs.php.net/bug.php?id=62886 - php-fpm startup
|
||||||
|
Patch23: php-5.4.7-fpm.patch
|
||||||
|
|
||||||
# Functional changes
|
# Functional changes
|
||||||
Patch40: php-5.4.0-dlopen.patch
|
Patch40: php-5.4.0-dlopen.patch
|
||||||
@ -90,7 +92,7 @@ Patch43: php-5.4.0-phpize.patch
|
|||||||
# Use system libzip instead of bundled one
|
# Use system libzip instead of bundled one
|
||||||
Patch44: php-5.4.5-system-libzip.patch
|
Patch44: php-5.4.5-system-libzip.patch
|
||||||
# https://bugs.php.net/63085 systemd integration
|
# https://bugs.php.net/63085 systemd integration
|
||||||
Patch45: php-fpm-systemd.patch.patch
|
Patch45: php-5.4.7-fpm-systemd.patch
|
||||||
|
|
||||||
# Fixes for tests
|
# Fixes for tests
|
||||||
|
|
||||||
@ -588,6 +590,7 @@ support for using the enchant library to PHP.
|
|||||||
%patch20 -p1 -b .imap
|
%patch20 -p1 -b .imap
|
||||||
%patch21 -p1 -b .odbctimer
|
%patch21 -p1 -b .odbctimer
|
||||||
%patch22 -p1 -b .tablename
|
%patch22 -p1 -b .tablename
|
||||||
|
%patch23 -p1 -b .fpmstartup
|
||||||
|
|
||||||
%patch40 -p1 -b .dlopen
|
%patch40 -p1 -b .dlopen
|
||||||
%patch41 -p1 -b .easter
|
%patch41 -p1 -b .easter
|
||||||
@ -596,7 +599,7 @@ support for using the enchant library to PHP.
|
|||||||
%if %{with_libzip}
|
%if %{with_libzip}
|
||||||
%patch44 -p1 -b .systzip
|
%patch44 -p1 -b .systzip
|
||||||
%endif
|
%endif
|
||||||
%patch45 -p0 -b .systemd
|
%patch45 -p1 -b .systemd
|
||||||
|
|
||||||
# Prevent %%doc confusion over LICENSE files
|
# Prevent %%doc confusion over LICENSE files
|
||||||
cp Zend/LICENSE Zend/ZEND_LICENSE
|
cp Zend/LICENSE Zend/ZEND_LICENSE
|
||||||
@ -1314,6 +1317,7 @@ fi
|
|||||||
* Mon Oct 1 2012 Remi Collet <remi@fedoraproject.org> 5.4.7-9
|
* Mon Oct 1 2012 Remi Collet <remi@fedoraproject.org> 5.4.7-9
|
||||||
- php-fpm: enable PrivateTmp
|
- php-fpm: enable PrivateTmp
|
||||||
- php-fpm: new systemd macros (#850268)
|
- php-fpm: new systemd macros (#850268)
|
||||||
|
- php-fpm: add upstream patch for startup issue (#846858)
|
||||||
|
|
||||||
* Fri Sep 28 2012 Remi Collet <rcollet@redhat.com> 5.4.7-8
|
* Fri Sep 28 2012 Remi Collet <rcollet@redhat.com> 5.4.7-8
|
||||||
- systemd integration, https://bugs.php.net/63085
|
- systemd integration, https://bugs.php.net/63085
|
||||||
|
Loading…
Reference in New Issue
Block a user