[php-src] Issue #24321: ZTS: `global_map_ptr_last` survives `zend_shutdown()`, so an in-process engine restart keeps growing the map_ptr table

From: Date: Wed, 14 Oct 2026 10:24:02 +0000
Subject: [php-src] Issue #24321: ZTS: `global_map_ptr_last` survives `zend_shutdown()`, so an in-process engine restart keeps growing the map_ptr table
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-252996@lists.php.net to get a copy of this message
Issue: https://github.com/php/php-src/issues/24321 Author: iloveleon19 Prepared with an AI assistant; I reviewed the analysis and the numbers. The text below is AI-generated (quoted, as asked in CONTRIBUTING.md). > FrankenPHP restarts the engine inside the same process on a config reload: > php_module_shutdown() (→ > zend_shutdown()), sapi_shutdown(), > tsrm_shutdown(), then a new > tsrm_startup() / sapi_startup() / > php_module_startup(). Zend/zend.c > keeps static size_t global_map_ptr_last across that, so the next > generation starts allocating map_ptr slots where the previous one stopped. > > On PHP 8.2.32 ZTS with 8 workers, CG(map_ptr_last) grew by > exactly 4769 per reload, linearly, and a long-running process reached about 51 generations' > worth. Each thread's map_ptr table grows without bound; we did not find it to be the cause of a > crash. > > A one-line change would reset it at the end of zend_shutdown(). > We have not checked the side effects in every SAPI, so we are reporting it rather than sending a PR.

« previous php.bugs (#252996) next »