Repository navigation
Fix GH-24361: Restore GC after opcache_compile_file errors - #25202
Open
akasakariko wants to merge 1 commit into
Open
akasakariko wants to merge 1 commit into
akasakariko wants to merge 1 commit into
Conversation
akasakariko
force-pushed
the
fix/gh-24361-opcache-compile-gc
branch
from
November 6, 2026 03:56
47c23e5 to
acde4be
Compare
Record fatal error origin before bailout and restore GC only for direct compiler failures, preserving runtime fatal protection Cover manual and automatic collection, error handlers and fatal callbacks
akasakariko
force-pushed
the
fix/gh-24361-opcache-compile-gc
branch
from
November 10, 2026 03:49
acde4be to
02f5c54
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Rebased onto the current target branch to resolve the NEWS conflict
Fixes #24361
zend_bailout() protects the GC while a fatal error unwinds, but opcache_compile_file() catches that bailout and returns false, so the request continues with the cycle collector disabled
Record the fatal error type, execution frame and GC protection state in a thread-local error observer before the bailout clears the execution frame
Restore the previous state only for E_COMPILE_ERROR raised in the current opcache_compile_file() frame and only when no OOM is pending
Runtime fatals, errors that unwind user callbacks, an already protected collector and preload failures keep their existing behavior, as do the diagnostics and the false return value
Reproduced on the unmodified target branch, GC becomes protected and gc_collect_cycles() returns 0 after the failed compile
After the change GC stays unprotected and gc_collect_cycles() collects the cycles
PHPT coverage checks manual and automatic collection, disabled automatic GC, a throwing warning handler, repeated errors, nested fatal compilation and memory exhaustion
Local verification on a debug NTS build, all five new tests pass, the OPcache suite has 985 tests with 944 passed, 1 expected failure, 40 skipped and 0 failures, the Zend suite has 5081 tests with 4931 passed, 1 expected failure, 149 skipped and 0 failures
The previous head passed the available CI matrix jobs, the rebased head will rerun them