diff options
author | Jérôme Loyet <fat@php.net> | 2009-12-19 15:24:09 +0000 |
---|---|---|
committer | Jérôme Loyet <fat@php.net> | 2009-12-19 15:24:09 +0000 |
commit | a6bff59737841a343443818346eda3a7fe1b31df (patch) | |
tree | 70c6cad17986394fb2261967537d09c6ee041bf1 | |
parent | 8d79b4d11431bcaa054688fe83196e16aabcd5fc (diff) | |
download | php-git-a6bff59737841a343443818346eda3a7fe1b31df.tar.gz |
fix dynamic process manager (max_children limit could be ignored)
-rw-r--r-- | sapi/fpm/fpm/fpm_process_ctl.c | 15 |
1 files changed, 14 insertions, 1 deletions
diff --git a/sapi/fpm/fpm/fpm_process_ctl.c b/sapi/fpm/fpm/fpm_process_ctl.c index dbdf9533fa..8ce35d17e9 100644 --- a/sapi/fpm/fpm/fpm_process_ctl.c +++ b/sapi/fpm/fpm/fpm_process_ctl.c @@ -363,13 +363,26 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{ wp->idle_spawn_rate = 1; continue; } - wp->warn_max_children = 0; if (wp->idle_spawn_rate >= 8) { zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] seems busy (you may need to increase start_servers, or min/max_spare_servers), spawning %d children, there are %d idle, and %d total children", wp->config->name, wp->idle_spawn_rate, idle, wp->running_children); } + /* compute the number of idle process to spawn */ i = MIN(wp->idle_spawn_rate, wp->config->pm->dynamic.min_spare_servers - idle); + + /* get sure it won't exceed max_children */ + i = MIN(i, wp->config->pm->max_children - wp->running_children); + if (i <= 0) { + if (!wp->warn_max_children) { + zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm->max_children); + wp->warn_max_children = 1; + } + wp->idle_spawn_rate = 1; + continue; + } + wp->warn_max_children = 0; + fpm_children_make(wp, 1, i, 1); /* if it's a child, stop here without creating the next event |