Skip to content

Add OPcache restart hook, fired when a restart is carried out - #23828

Open
nicolas-grekas wants to merge 1 commit into
php:masterfrom
nicolas-grekas:opcache-restart-hook
Open

nicolas-grekas wants to merge 1 commit into
php:masterfrom
nicolas-grekas:opcache-restart-hook

Conversation

@nicolas-grekas

Copy link
Copy Markdown
Contributor

After #15590, which added zend_accel_schedule_restart_hook.

That hook says a restart of OPcache's shared memory is coming, not that it happened: the restart runs later, at request startup, on whichever thread or process first finds the cache unused, and it can stay pending for a long time. This adds zend_accel_restart_hook, called on that thread once per restart, right after it completed and still under the SHM lock, with the same reason.

FrankenPHP needs it for its logs and metrics: under ZTS the restart rewinds shared memory that other threads may still reference, so the exact moment matters for post-mortems, and the scheduling event alone doesn't tell an operator whether the restart ran at all.

This targets master, like #15590 did at the same point of the 8.4 cycle.

zend_accel_schedule_restart_hook tells an observer that a restart of
OPcache's shared memory is coming, but not whether or when it happens:
the restart runs later, at request startup, on whichever thread or
process first finds the cache unused, and it can stay pending for a
long time. This adds zend_accel_restart_hook, called on that thread once
per restart, right after the restart completed, with the same reason.
A threaded SAPI needs it for its logs and metrics, since the restart
rewinds shared memory that other threads may still reference.
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