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);
}
- 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'");
}
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");