Repository navigation
PHP 8.3.30 - CLI Segmentation Fault Signal 11 when script finishes (core dumped) #21600
Copy link
Copy link
Closed
Closed
Copy link
Description
Description
The following code:
<?php
#!/usr/bin/env php
/**
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
if (PHP_SAPI !== 'cli') {
echo 'bin/magento must be run as a CLI application';
exit(1);
}
try {
require __DIR__ . '/../app/bootstrap.php';
} catch (\Exception $e) {
echo 'Autoload error: ' . $e->getMessage();
exit(1);
}
try {
$handler = new \Magento\Framework\App\ErrorHandler();
set_error_handler([$handler, 'handler']);
$application = new Magento\Framework\Console\Cli('Magento CLI');
$application->run();
} catch (\Throwable $e) {
while ($e) {
if ($e->getFile()) {
echo sprintf("\nThere is an error in %s", $e->getFile());
if ($e->getLine()) {
echo sprintf(" at line: %d", $e->getLine());
}
echo "\n";
}
echo $e->getMessage();
echo $e->getTraceAsString();
echo "\n\n";
$e = $e->getPrevious();
}
exit(Magento\Framework\Console\Cli::RETURN_FAILURE);
}
?>
Resulted in this output:
Flushed cache types:
config
layout
block_html
collections
reflection
db_ddl
compiled_config
eav
customer_notification
config_integration
config_integration_api
graphql_query_resolver_result
full_page
config_webservice
translate
Segmentation fault <------------ NOTE ------------<<<
But I expected this output instead:
No segfault when done running the script.
Note that the script finishes successfully - problem shutting down in right order?
GDB
Reading symbols from /usr/local/bin/php...
(No debugging symbols found in /usr/local/bin/php)
[New LWP 100537]
Core was generated by `php: /usr/local/bin/php /usr/local/www/webroot/bin/magento c'.
Program terminated with signal SIGSEGV, Segmentation fault.
Address not mapped to object.
#0 0x000000082759a8fd in ?? () from /lib/libc.so.7
(gdb) bt
#0 0x000000082759a8fd in ?? () from /lib/libc.so.7
#1 0x000000082759196d in ?? () from /lib/libc.so.7
#2 0x0000000825e24cd8 in xmlHashFree () from /usr/local/lib/libxml2.so.16
#3 0x000000085d1eae0e in xsltCleanupGlobals () from /usr/local/lib/libxslt.so.1
#4 0x000000085bac5549 in zm_shutdown_xsl () from /usr/local/lib/php/20230831/xsl.so
#5 0x00000000005ddeda in ?? ()
#6 0x00000000005eac45 in zend_hash_graceful_reverse_destroy ()
#7 0x00000000005d2b18 in ?? ()
#8 0x00000000005619d9 in php_module_shutdown ()
#9 0x00000000006c18fa in ?? ()
#10 0x000000082749f37f in __libc_start1 () from /lib/libc.so.7
#11 0x00000000003f08c4 in _start ()
(gdb)
PHP Version
PHP 8.3.30 (cli) (built: Mar 31 2026 19:06:24) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.3.30, Copyright (c) Zend Technologies
with Zend OPcache v8.3.30, Copyright (c), by Zend Technologies
Operating System
FreeBSD 15
Activity
devnexen commentedon Apr 2, 2026
Hi @Munktells what are the dependencies versions ? i.e.
pkg info libxml2 libxsltMunktells commentedon Apr 2, 2026
The current versions in the system is:
devnexen commentedon Apr 2, 2026
I may have a look later but do you have the possibility to quickly test with a newer php version ?
Munktells commentedon Apr 2, 2026
No not at the moment I'm afraid, that could break other functions, not yet compatible with PHP 8.4/8.5.
I need to stay on PHP 8.3 for a short while more.
devnexen commentedon Apr 2, 2026
Ok fair enough, not sure if this is misuage of libxslt api here ; wrong extension shutdown sequence to which it might have been fixed already in upper branches ... we ll see !
Munktells commentedon Apr 2, 2026
More people seem to have similar problems, even in 8.4 and 8.5, someone pointed this to me:
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=291622
nwellnhof commentedon Apr 2, 2026
Here's another FreeBSD bug report with two different stack traces: https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=277888
One of them doesn't involve the xsl module, so the issue might be unrelated to libxslt.
Munktells commentedon Apr 2, 2026
I might need to move over to 8.4.x sooner than later, just saw that 8.3.x only gets security updates from now on.
Let me get back if this PR goes away with 8.4.x.
Fix phpGH-21600: Remove xsltCleanupGlobals call in ext/xsl MSHUTDOWN.
Munktells commentedon Apr 4, 2026
The issue is still present when upgrading to PHP 8.4.19, on FreeBSD 15.0-RELEASE-p5 (and others?).
But the commit fixes the issue, no more segfaults and signal 11 when script finishes.
Fix GH-21600: Remove xsltCleanupGlobals call in ext/xsl MSHUTDOWN.
Merge branch 'PHP-8.4' into PHP-8.5
Merge branch 'PHP-8.5'