Skip to content

Commit

Permalink
FPM: Prevent warning with raising pm.max_children for shared pool
Browse files Browse the repository at this point in the history
  • Loading branch information
bukka committed Aug 4, 2020
1 parent a359635 commit 37a878b
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 13 deletions.
2 changes: 0 additions & 2 deletions sapi/fpm/fpm/fpm_conf.c
Original file line number Diff line number Diff line change
Expand Up @@ -725,8 +725,6 @@ static int fpm_worker_pool_shared_status_alloc(struct fpm_worker_pool_s *shared_

config->pm = PM_STYLE_ONDEMAND;
config->pm_max_children = 2;
/* set to 1 to not warn about max children for shared pool */
shared_wp->warn_max_children = 1;

current_wp->shared = shared_wp;

Expand Down
14 changes: 5 additions & 9 deletions sapi/fpm/fpm/fpm_process_ctl.c
Original file line number Diff line number Diff line change
Expand Up @@ -390,7 +390,7 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{

if (idle < wp->config->pm_min_spare_servers) {
if (wp->running_children >= wp->config->pm_max_children) {
if (!wp->warn_max_children) {
if (!wp->warn_max_children && !wp->shared) {
fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached pm.max_children setting (%d), consider raising it", wp->config->name, wp->config->pm_max_children);
wp->warn_max_children = 1;
Expand All @@ -409,17 +409,15 @@ static void fpm_pctl_perform_idle_server_maintenance(struct timeval *now) /* {{{
/* get sure it won't exceed max_children */
children_to_fork = MIN(children_to_fork, wp->config->pm_max_children - wp->running_children);
if (children_to_fork <= 0) {
if (!wp->warn_max_children) {
if (!wp->warn_max_children && !wp->shared) {
fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(ZLOG_WARNING, "[pool %s] server reached pm.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;
}
if (!wp->shared) {
wp->warn_max_children = 0;
}
wp->warn_max_children = 0;

fpm_children_make(wp, 1, children_to_fork, 1);

Expand Down Expand Up @@ -515,7 +513,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg) /
/* zlog(ZLOG_DEBUG, "[pool %s] heartbeat running_children=%d", wp->config->name, wp->running_children);*/

if (wp->running_children >= wp->config->pm_max_children) {
if (!wp->warn_max_children) {
if (!wp->warn_max_children && !wp->shared) {
fpm_scoreboard_update(0, 0, 0, 0, 0, 1, 0, FPM_SCOREBOARD_ACTION_INC, wp->scoreboard);
zlog(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;
Expand All @@ -530,9 +528,7 @@ void fpm_pctl_on_socket_accept(struct fpm_event_s *ev, short which, void *arg) /
return;
}
}
if (!wp->shared) {
wp->warn_max_children = 0;
}
wp->warn_max_children = 0;
fpm_children_make(wp, 1, 1, 1);

if (fpm_globals.is_child) {
Expand Down
2 changes: 0 additions & 2 deletions sapi/fpm/tests/status-listen.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
FPM: Status listen test
--SKIPIF--
<?php include "skipif.inc"; ?>
--XFAIL--
Flaky test
--FILE--
<?php

Expand Down

0 comments on commit 37a878b

Please sign in to comment.