|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2019-12-25 21:25 UTC] florian dot schmidt dot stargatewissen at gmail dot com
[2020-04-04 13:31 UTC] florian dot schmidt dot stargatewissen at gmail dot com
-Status: Open
+Status: Closed
[2020-04-04 13:31 UTC] florian dot schmidt dot stargatewissen at gmail dot com
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Mon Oct 27 02:00:01 2025 UTC |
Description: ------------ I'm trying to make the MediaWiki software ready to be preloaded during the satrtup of a php-fpm worker pool. I'm loading all the MediaWiki related code during the startup, see the test script. The fpm is starting without any problem (except some files could not be pre-loaded, as their parent classes where not preloaded also). When a request reaches the fpm pool, the worker SIGSEGVs (segmentation fault) with the following core dump: Program terminated with signal SIGSEGV, Segmentation fault. #0 0x000055d1f20286e9 in zend_remove_ini_entries (el=0x55d1f43e09a0, arg=0x7ffd91ccd7cc) at /home/florian/php-src/Zend/zend_ini.c:40 40 return ini_entry->module_number == module_number; (gdb) bt #0 0x000055d1f20286e9 in zend_remove_ini_entries (el=0x55d1f43e09a0, arg=0x7ffd91ccd7cc) at /home/florian/php-src/Zend/zend_ini.c:40 #1 0x000055d1f202030e in zend_hash_apply_with_argument (ht=0x55d1f427d750, apply_func=apply_func@entry=0x55d1f20286e0 <zend_remove_ini_entries>, argument=argument@entry=0x7ffd91ccd7cc) at /home/florian/php-src/Zend/zend_hash.c:1839 #2 0x000055d1f2028ce4 in zend_unregister_ini_entries (module_number=<optimized out>) at /home/florian/php-src/Zend/zend_ini.c:271 #3 0x00007fa64e6c15af in zm_shutdown_zend_accelerator (type=<optimized out>, module_number=<optimized out>) at /home/florian/php-src/ext/opcache/zend_accelerator_module.c:422 #4 0x000055d1f20148df in module_destructor (module=module@entry=0x55d1f4442050) at /home/florian/php-src/Zend/zend_API.c:2382 #5 0x000055d1f200e780 in module_destructor_zval (zv=<optimized out>) at /home/florian/php-src/Zend/zend.c:769 #6 0x000055d1f201feda in _zend_hash_del_el_ex (prev=<optimized out>, p=<optimized out>, idx=33, ht=<optimized out>) at /home/florian/php-src/Zend/zend_hash.c:1308 #7 _zend_hash_del_el (p=0x55d1f42ec8f0, idx=33, ht=0x55d1f2cf9060 <module_registry>) at /home/florian/php-src/Zend/zend_hash.c:1331 #8 zend_hash_graceful_reverse_destroy (ht=ht@entry=0x55d1f2cf9060 <module_registry>) at /home/florian/php-src/Zend/zend_hash.c:1785 #9 0x000055d1f2013250 in zend_destroy_modules () at /home/florian/php-src/Zend/zend_API.c:1837 #10 0x000055d1f200f6ce in zend_shutdown () at /home/florian/php-src/Zend/zend.c:1069 #11 0x000055d1f1faed55 in php_module_shutdown () at /home/florian/php-src/main/main.c:2446 #12 0x000055d1f1fb0635 in php_module_shutdown () at /home/florian/php-src/main/main.c:2429 #13 0x000055d1f20a067d in fpm_php_cleanup (which=<optimized out>, arg=<optimized out>) at /home/florian/php-src/sapi/fpm/fpm/fpm_php.c:198 #14 0x000055d1f2098f2d in fpm_cleanups_run (type=type@entry=4) at /home/florian/php-src/sapi/fpm/fpm/fpm_cleanup.c:43 #15 0x000055d1f20a1144 in fpm_pctl_exit () at /home/florian/php-src/sapi/fpm/fpm/fpm_process_ctl.c:71 #16 fpm_pctl_action_last () at /home/florian/php-src/sapi/fpm/fpm/fpm_process_ctl.c:118 #17 0x000055d1f20a202b in fpm_pctl (action=2, new_state=0) at /home/florian/php-src/sapi/fpm/fpm/fpm_process_ctl.c:260 #18 fpm_pctl_child_exited () at /home/florian/php-src/sapi/fpm/fpm/fpm_process_ctl.c:260 #19 0x000055d1f2098a57 in fpm_children_bury () at /home/florian/php-src/sapi/fpm/fpm/fpm_children.c:266 #20 0x000055d1f209dc8a in fpm_event_fire (ev=0x55d1f2cf2600 <children_bury_timer>) at /home/florian/php-src/sapi/fpm/fpm/fpm_events.c:482 #21 fpm_event_loop (err=err@entry=0) at /home/florian/php-src/sapi/fpm/fpm/fpm_events.c:462 #22 0x000055d1f2098297 in fpm_run (max_requests=0x7ffd91ccdcac) at /home/florian/php-src/sapi/fpm/fpm/fpm.c:113 #23 0x000055d1f1d1ccee in main (argc=6, argv=0x7ffd91cce1d8) at /home/florian/php-src/sapi/fpm/fpm/fpm_main.c:1852 I compiled php from source (git master as of 7d07f19eee468292905384e6d7c26e2dfe39dd6f and compiled with the following configure: ./configure --prefix=/usr/local/php --enable-mbstring --enable-opcache --enable-fpm --with-curl --with-openssl --with-mysqli --enable-intl --with-zlib Preloading is enabled by the following config options in php.ini: opcache.enable=1 opcache.preload=/var/www/html/w/preload.php opcache.preload_user=www-data zend_extension=/usr/local/php/lib/php/extensions/no-debug-non-zts-20190128/opcache.so The requests reaches fpm from nginx, if that matters for that case :) Test script: --------------- <?php function _preload( $preload, string $pattern = "/\.php$/", array $ignore = [] ) { if ( is_array( $preload ) ) { foreach ( $preload as $path ) { _preload( $path, $pattern, $ignore ); } } else { if ( is_string( $preload ) ) { $path = $preload; if ( !in_array( $path, $ignore ) && !strpos( $path, 'test' ) && !strpos( $path, 'tests' ) && !strpos( $path, 'Test' ) && !strpos( $path, 'Tests' ) && !strpos( $path, 'scripts' ) ) { if ( is_dir( $path ) ) { if ( $dh = opendir( $path ) ) { while ( ( $file = readdir( $dh ) ) !== false ) { if ( $file !== "." && $file !== ".." ) { _preload( $path . "/" . $file, $pattern, $ignore ); } } closedir( $dh ); } } else { if ( is_file( $path ) && preg_match( $pattern, $path ) ) { if ( !opcache_compile_file( $path ) ) { trigger_error( "Preloading Failed", E_USER_ERROR ); } } } } } } } _preload( [ __DIR__ . '/includes', ], "/\.php$/", [ __DIR__ . "/vendor/khanamiryan", __DIR__ . "/preload.php", ] );