[php-src] Issue #20307: zend_mm_heap corrupted in rebuild_object_properties_internal during GC on PHP 8.4.14
| From: | ruudk | Date: | Mon, 27 Oct 2025 11:00:39 +0000 |
| Subject: | [php-src] Issue #20307: zend_mm_heap corrupted in rebuild_object_properties_internal during GC on PHP 8.4.14 | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-251126@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/20307
Author: ruudk
### Description
We're experiencing intermittent crashes with
zend_mm_heap corrupted errors during
PHPUnit test execution on PHP 8.4.14. The crash occurs in the garbage collector while rebuilding
object properties.
### PHP Version
PHP 8.4.14
### Operating System
Ubuntu 24.04 x86_64 (GitHub Actions runner: depot-ubuntu-24.04)
### Reproduction
The crash happens intermittently when running PHPUnit tests with:
- APP_DEBUG=1
- Random test order (--order-by=random)
- Large test suite (~7748 tests)
The crash appears to be related to garbage collection triggered during test execution.
### Backtrace
```
Program terminated with signal SIGABRT, Aborted.
#0 __pthread_kill_implementation (no_tid=0, signo=6, threadid=<optimized out>) at
./nptl/pthread_kill.c:44
#1 __pthread_kill_internal (signo=6, threadid=<optimized out>) at ./nptl/pthread_kill.c:78
#2 __GI___pthread_kill (threadid=<optimized out>, signo=signo@entry=6) at
./nptl/pthread_kill.c:89
#3 0x00007f813784527e in __GI_raise (sig=sig@entry=6) at ../sysdeps/posix/raise.c:26
#4 0x00007f81378288ff in __GI_abort () at ./stdlib/abort.c:79
#5 0x0000564c8fc0e291 in ?? ()
#6 0x0000564c8fc0e3a5 in ?? ()
#7 0x0000564c8fed6244 in _zend_new_array ()
#8 0x0000564c8ff0a871 in rebuild_object_properties_internal ()
#9 0x0000564c8fed2249 in zend_gc_collect_cycles ()
#10 0x0000564c8fed04c8 in ?? ()
#11 0x0000564c8fecbb00 in execute_ex ()
#12 0x0000564c8fec1b41 in zend_execute ()
#13 0x0000564c8ff2d0e6 in zend_execute_script ()
#14 0x0000564c8fdbe6a8 in php_execute_script_ex ()
#15 0x0000564c8ff2eff0 in ?? ()
#16 0x0000564c8fc32a03 in ?? ()
```
Full command that crashed:
```
php -d memory_limit=-1 vendor/bin/phpunit --order-by=random --random-order-seed=<seed>
```
### Analysis
The crash occurs during:
1. Garbage collection cycle (zend_gc_collect_cycles)
2. While rebuilding object properties (rebuild_object_properties_internal)
3. When creating a new array (_zend_new_array)
4. PHP's memory manager detects heap corruption and calls abort()
### Relationship to Existing Issues
This appears to be related to the systemic GC/destructor issues tracked in #20001. Similar issues
were reported in #17866 and #17868, which were supposedly fixed in PHP 8.4.5, but we're seeing
this on 8.4.14.
### Configuration
- OPcache: Enabled (but disabled for CLI)
- JIT: Not enabled
- Extensions: Standard Symfony/PHPUnit stack
- Memory limit: Unlimited (-1)
### Frequency
The crash is intermittent but reproducible when running the full test suite multiple times. It
doesn't always occur on the same test.
### Workaround
Disabling GC with gc_disable() or zend.enable_gc=0 prevents the crash,
confirming it's GC-related.
### Additional Context
We've captured core dumps and can provide more detailed debugging information if needed. The
crash is blocking our CI pipeline as it occurs randomly during test execution.