Fix GH-21600: Remove xsltCleanupGlobals call in ext/xsl MSHUTDOWN.#21610
Fix GH-21600: Remove xsltCleanupGlobals call in ext/xsl MSHUTDOWN.#21610devnexen wants to merge 1 commit intophp:PHP-8.4from
Conversation
The call to xsltCleanupGlobals() during module shutdown can cause a segfault in xmlHashFree() when freeing libxslt internal hash tables. This is the same class of shutdown cleanup issue that led to xmlCleanupParser() being removed from ext/libxml. The process is about to exit and the OS will reclaim all memory, making the explicit cleanup both unnecessary and harmful.
|
It's a bit strange. I'd like to first better understand what is causing the segfault. |
|
I ran it under Valgrind with USE_ZEND_ALLOC=0 — valgrind is clean, but I wasn't able to reproduce the same circumstances as the original report (many shared That said, this is the same class of bug that was fixed in ext/libxml by 8742276 where xmlCleanupParser() was removed from xsltCleanupGlobals() is the xslt-side equivalent — it tears down global state (frees xsltFunctionsHash, xsltExtMutex, resets initialized = 0) that can be re-entered |
ndossche
left a comment
There was a problem hiding this comment.
I think this may not actually fix the real problem, but I can't prove nor disprove this.
If this helps then sure.
In typical PHP fashion, the original referenced commit is borderline useless as it doesn't contain any useful background info.
There is a more general issue with shared extensions loading order indeed. In typical PHP fashion, the original referenced commit is borderline useless as it doesn't contain any useful background info. Even tough you think it I hope you stick around a little bit ;) |
The call to xsltCleanupGlobals() during module shutdown can cause a segfault in xmlHashFree() when freeing libxslt internal hash tables. This is the same class of shutdown cleanup issue that led to xmlCleanupParser() being removed from ext/libxml. The process is about to exit and the OS will reclaim all memory, making the explicit cleanup both unnecessary and harmful.