Skip to content

Fix GH-18956: PHP-FPM Process Count Inconsistencies #19191

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: PHP-8.3
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions sapi/fpm/fpm/fpm_main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1973,6 +1973,8 @@ consult the installation file that came with this distribution, or visit \n\

fpm_stdio_flush_child();

fpm_request_shutdown();

requests++;
if (UNEXPECTED(max_requests && (requests == max_requests))) {
fcgi_request_set_keep(request, 0);
Expand Down
10 changes: 8 additions & 2 deletions sapi/fpm/fpm/fpm_request.c
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,8 @@ void fpm_request_accepting(void)
proc->tv = now;
fpm_scoreboard_proc_release(proc);

/* idle++, active-- */
fpm_scoreboard_update_commit(1, -1, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
/* idle++ */
fpm_scoreboard_update_commit(1, 0, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
}

void fpm_request_reading_headers(void)
Expand Down Expand Up @@ -220,6 +220,12 @@ void fpm_request_finished(void)
fpm_scoreboard_proc_release(proc);
}

void fpm_request_shutdown(void)
{
/* active-- */
fpm_scoreboard_update(0, -1, 0, 0, 0, 0, 0, FPM_SCOREBOARD_ACTION_INC, NULL);
}

void fpm_request_check_timed_out(struct fpm_child_s *child, struct timeval *now, int terminate_timeout, int slowlog_timeout, int track_finished) /* {{{ */
{
struct fpm_scoreboard_proc_s proc, *proc_p;
Expand Down
2 changes: 2 additions & 0 deletions sapi/fpm/fpm/fpm_request.h
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ void fpm_request_executing(void);
void fpm_request_end(void);
/* request processed: cleaning current request */
void fpm_request_finished(void);
/* request post shutdown: decrement active */
void fpm_request_shutdown(void);

struct fpm_child_s;
struct timeval;
Expand Down
Loading