Skip to content

Commit a6bff59

Browse files
author
Jérôme Loyet
committed
fix dynamic process manager (max_children limit could be ignored)
1 parent 8d79b4d commit a6bff59

File tree

1 file changed

+14
-1
lines changed

1 file changed

+14
-1
lines changed

sapi/fpm/fpm/fpm_process_ctl.c

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -363,13 +363,26 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{
363363
wp->idle_spawn_rate = 1;
364364
continue;
365365
}
366-
wp->warn_max_children = 0;
367366

368367
if (wp->idle_spawn_rate >= 8) {
369368
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);
370369
}
371370

371+
/* compute the number of idle process to spawn */
372372
i = MIN(wp->idle_spawn_rate, wp->config->pm->dynamic.min_spare_servers - idle);
373+
374+
/* get sure it won't exceed max_children */
375+
i = MIN(i, wp->config->pm->max_children - wp->running_children);
376+
if (i <= 0) {
377+
if (!wp->warn_max_children) {
378+
zlog(ZLOG_STUFF, ZLOG_WARNING, "[pool %s] server reached max_children setting (%d), consider raising it", wp->config->name, wp->config->pm->max_children);
379+
wp->warn_max_children = 1;
380+
}
381+
wp->idle_spawn_rate = 1;
382+
continue;
383+
}
384+
wp->warn_max_children = 0;
385+
373386
fpm_children_make(wp, 1, i, 1);
374387

375388
/* if it's a child, stop here without creating the next event

0 commit comments

Comments
 (0)