]> granicus.if.org Git - php/commitdiff
fix revision r313323
authorJérôme Loyet <fat@php.net>
Sun, 17 Jul 2011 14:28:31 +0000 (14:28 +0000)
committerJérôme Loyet <fat@php.net>
Sun, 17 Jul 2011 14:28:31 +0000 (14:28 +0000)
sapi/fpm/fpm/fpm.h
sapi/fpm/fpm/fpm_children.c
sapi/fpm/fpm/fpm_conf.c

index bfe2be8d1e6e21781a3b859a7b298bef364b7c9f..3c6f798fba6ff127f2b1b918c3d5a10b9c4b8e79 100644 (file)
@@ -24,7 +24,6 @@ struct fpm_globals_s {
        int max_requests; /* for this child */
        int is_child;
        int test_successful;
-       int process_max; /* global */
 };
 
 extern struct fpm_globals_s fpm_globals;
index fbe9d980d85bdb377203bdfb87aee3e03e6087ea..769c519a85600a9989b40b96342cfd58df32565c 100644 (file)
@@ -375,7 +375,14 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to
                max = wp->config->pm_max_children;
        }
 
-       while (fpm_pctl_can_spawn_children() && wp->running_children < max && fpm_globals.running_children < fpm_global_config.process_max) {
+       /*
+        * fork children while:
+        *   - fpm_pctl_can_spawn_children : FPM is running in a NORMAL state (aka not restart, stop or reload)
+        *   - wp->running_children < max  : there is less than the max process for the current pool
+        *   - (fpm_global_config.process_max < 1 || fpm_globals.running_children < fpm_global_config.process_max):
+        *     if fpm_global_config.process_max is set, FPM has not fork this number of processes (globaly)
+        */
+       while (fpm_pctl_can_spawn_children() && wp->running_children < max && (fpm_global_config.process_max < 1 || fpm_globals.running_children < fpm_global_config.process_max)) {
 
                warned = 0;
                child = fpm_resources_prepare(wp);
@@ -410,7 +417,7 @@ int fpm_children_make(struct fpm_worker_pool_s *wp, int in_event_loop, int nb_to
 
        }
 
-       if (!warned && fpm_globals.running_children >= fpm_global_config.process_max) {
+       if (!warned && fpm_global_config.process_max > 0 && fpm_globals.running_children >= fpm_global_config.process_max) {
                warned = 1;
                zlog(ZLOG_WARNING, "The maximum number of processes has been reached. Please review your configuration and consider raising 'process.max'");
        }
index 755346fa6faec13fcea1253781694c08860c5d0c..edb514f1be419b36ad1cbfef805eb4fc3cb38650 100644 (file)
@@ -1020,7 +1020,6 @@ static int fpm_conf_post_process(TSRMLS_D) /* {{{ */
                zlog(ZLOG_ERROR, "process_max can't be negative");
                return -1;
        }
-       fpm_globals.process_max = fpm_global_config.process_max;
 
        if (!fpm_global_config.error_log) {
                fpm_global_config.error_log = strdup("log/php-fpm.log");