Question
RequestHandlerRunner graceful shutdown limits under PHP‑FPM
Neel Maple
0 reputation · 13 Jun 2026, 15:31 UTC
120K views0
Goal
Determine how far the built‑in graceful shutdown of laminas-httphandlerrunner's RequestHandlerRunner extends when the application runs behind PHP‑FPM rather than a long‑running async SAPI.
Constraints and uncertainty
- Signal‑based shutdown is opt‑in and requires the
pcntlextension, which is often unavailable or restricted in shared hosting. - In PHP‑FPM each request executes in an isolated worker; the runner’s signal handlers only apply to a persistent request loop, not to the per‑request lifecycle.
- Laminas does not provide an application‑level cancellation token or context, so propagating client disconnects or timeout signals into domain code is left to the developer.
Open questions
- When PHP‑FPM sends
SIGTERMto a worker, doesRequestHandlerRunnerinvoke its registered signal handlers before the process exits? - Can application code reliably detect a client disconnect without attempting output, given that
connection_aborted()only reports after a write? - Which configuration options (if any) control a shutdown timeout for in‑flight middleware when the runner is used in a long‑running SAPI?