Skip to content

ext/opcache: opcache.interned_strings_buffer per FPM pool crashed on … - #23309

Closed
devnexen wants to merge 4 commits into
php:PHP-8.4from
devnexen:gh23288
Closed

devnexen wants to merge 4 commits into
php:PHP-8.4from
devnexen:gh23288

Conversation

@devnexen

Copy link
Copy Markdown
Member

…restart.

Fix #23288

The directive was still accepted once the shared interned string table had been sized from the master php.ini, so a diverging pool value made the next restart run accel_interned_strings_restore_state() against a table that was never allocated. Reject post-startup changes like opcache.memory_consumption and gate the restore on the shared table state instead of the per-process directive.

…restart.

Fix php#23288

The directive was still accepted once the shared interned string table
had been sized from the master php.ini, so a diverging pool value made
the next restart run accel_interned_strings_restore_state() against a
table that was never allocated. Reject post-startup changes like
opcache.memory_consumption and gate the restore on the shared table
state instead of the per-process directive.
@devnexen
devnexen marked this pull request as ready for review August 16, 2026 12:27
@devnexen
devnexen requested review from bukka and dstogov as code owners August 16, 2026 12:27
@devnexen
devnexen requested a review from arnaud-lb August 16, 2026 12:27
Comment thread ext/opcache/zend_accelerator_module.c Resolved

@arnaud-lb arnaud-lb left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me!

@devnexen devnexen closed this in bfbae39 Aug 20, 2026
@devnexen
devnexen deleted the gh23288 branch August 23, 2026 14:26
devnexen pushed a commit to devnexen/php-src that referenced this pull request Oct 30, 2026
…(ZTS)

Since phpGH-23309 OnUpdateInternedStringsBuffer() rejects any change once
OPcache is set up, to catch diverging php_admin_value settings of FPM
pools. Under ZTS every thread started after OPcache's startup re-applies
the INI entries with ZEND_INI_STAGE_STARTUP into its own, zeroed
zend_accel_globals; the handler rejects that as well, logs a warning
for every new thread and leaves ZCG(accel_directives).
interned_strings_buffer at 0 in that thread (e.g. opcache_get_configuration()
reports 0 under FrankenPHP and Apache mod_php with threaded MPMs).

Accept the value at ZEND_INI_STAGE_STARTUP: it is the value the shared
memory was set up with. Changes at later stages (FPM pools use
ZEND_INI_STAGE_ACTIVATE) are still rejected.

Closes phpGH-24275.
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.

3 participants