Skip to content

Fix FPM status counts on reused FastCGI connections - #25620

Open
AceMedia wants to merge 1 commit into
php:PHP-8.4from
AceMedia:fix-fpm-status-keepalive-counters
Open

AceMedia wants to merge 1 commit into
php:PHP-8.4from
AceMedia:fix-fpm-status-keepalive-counters

Conversation

@AceMedia

@AceMedia AceMedia commented Nov 20, 2026 •

Copy link
Copy Markdown

AI-assisted implementation, testing and drafting.

A worker serving several FastCGI requests on one connection increments FPM's active count for every request, but only returns to idle when it accepts another connection. The status page can therefore report more active and total processes than actual workers.

I've changed the counter updates to use the worker's existing request stage. Moving to idle or active updates those counts once per transition, while every request still increments accepted conn. The new PHPT checks fresh and persistent connections, the actual worker PID, active/idle/total and peak counts, and request totals.

On Linux x86-64 under WSL2, the regression fails on the unmodified PHP-8.4 base d8e34952 and PHP 8.6.0, and passes with this change on both. The PHP 8.4 FPM suite passed 133 runnable tests, with 15 skips. On PHP 8.6.0, 147 tests passed and 13 skipped; the one failure is the separate OPcache map-pointer regression for GH-23859, which also fails on the unmodified release. A private FPM probe passed worker-state checks under static, dynamic and ondemand managers. With pm.max_requests=5, both keepalive and fresh connections still returned five responses per worker across 30 responses.

I also checked four concurrent, reused connections on both patched builds. The status showed four active workers while all four were busy and four idle workers after they finished. With pm.max_requests=2, each worker still served two responses before recycling, across 12 requests.

This addresses the reproducible status-count case in #14212. I know #19191 is also open; this patch changes only the FPM scoreboard updates and leaves the FastCGI callback API alone. I haven't reproduced the original 1,500-worker workload. Native Windows, ZTS and 32-bit checks are covered by the PR's CI rather than my WSL runs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant