[php-src] PR #21527: Fix GH-19983: GC assertion failure with fibers, generators and destructors
| From: | iliaal | Date: | Wed, 25 Mar 2026 15:32:23 +0000 |
| Subject: | [php-src] PR #21527: Fix GH-19983: GC assertion failure with fibers, generators and destructors | ||
| Groups: | php.git-pulls | ||
| Request: | Send a blank email to git-pulls+get-35355@lists.php.net to get a copy of this message | ||
Pull Request: https://github.com/php/php-src/pull/21527
Author: iliaal
When GC runs inside a fiber handling an exception (e.g. during
zend_fiber_object_destroy), EG(exception) is set.
gc_call_destructors_in_fiber() saved and cleared the exception **after** creating the
destructor fiber. Since zend_call_function() returns early when
EG(exception) is set, the destructor fiber's handler never ran, leaving
DTOR_GARBAGE entries in the root buffer. On the next GC cycle,
gc_collect_roots() hit an alignment assertion on these stale entries.
Move remember_prev_exception() before the destructor fiber creation/resume so
EG(exception) is cleared before zend_call_function() runs inside the
fiber.
Fixes #19983