Bug #81353 [Opn]: segfault with preloading and error_handler

From: Date: Mon, 16 Aug 2021 07:20:55 +0000
Subject: Bug #81353 [Opn]: segfault with preloading and error_handler
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-235836@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=81353&edit=1

 ID:                 81353
 Updated by:         mike@php.net
 Reported by:        mike@php.net
 Summary:            segfault with preloading and error_handler
 Status:             Open
 Type:               Bug
 Package:            opcache
 Operating System:   Linux, macOS
 PHP Version:        7.4Git
 Block user comment: N
 Private report:     N

 New Comment:

Looks like it has to do with the static arrays and calling Closure::bind() with a class scope in
composer's autoload_static.


Previous Comments:
------------------------------------------------------------------------
[2021-08-16 06:17:08] mike@php.net

ASAN backtrace:

    frame #5: 0x0000000100dd7bf4 php`zend_gc_refcount(p=0x0000000106452ca0) at zend_types.h:1025:12
    frame #6: 0x0000000100daa98c
php`ZEND_BIND_STATIC_SPEC_CV_UNUSED_HANDLER(execute_data=0x0000000110604f20) at
zend_vm_execute.h:46571:13
    frame #7: 0x0000000100c16514 php`execute_ex(ex=0x0000000110604f20) at zend_vm_execute.h:53291:7
    frame #8: 0x0000000100a915d4 php`zend_call_function(fci=0x000000016fdf8a70,
fci_cache=0x000000016fdf8ad0) at zend_execute_API.c:820:3
    frame #9: 0x00000001005b1354 php`zif_spl_autoload_call(execute_data=0x0000000110604ec0,
return_value=0x000000016fdf9ce0) at php_spl.c:452:4
    frame #10: 0x0000000100a91890 php`zend_call_function(fci=0x000000016fdf9d00,
fci_cache=0x000000016fdf9d60) at zend_execute_API.c:833:4
    frame #11: 0x0000000100a93878 php`zend_lookup_class_ex(name=0x000000010647da80,
key=0x000000010647da20, flags=512) at zend_execute_API.c:1002:7
    frame #12: 0x0000000100a960ac php`zend_fetch_class_by_name(class_name=0x000000010647da80,
key=0x000000010647da20, fetch_type=512) at zend_execute_API.c:1433:19
    frame #13: 0x0000000100ce0b24
php`ZEND_NEW_SPEC_CONST_UNUSED_HANDLER(execute_data=0x0000000110604b80) at zend_vm_execute.h:9255:9
    frame #14: 0x0000000100c16514 php`execute_ex(ex=0x0000000110604820) at zend_vm_execute.h:53291:7
    frame #15: 0x0000000100a915d4 php`zend_call_function(fci=0x000000016fdfb4a0,
fci_cache=0x000000016fdfa830) at zend_execute_API.c:820:3
    frame #16: 0x0000000100a8f3b8 php`_call_user_function_ex(object=0x0000000000000000,
function_name=0x000000016fdfb7b0, retval_ptr=0x000000016fdfb790, param_count=5,
params=0x000000016fdfb720, no_separation=1) at zend_execute_API.c:645:9
    frame #17: 0x0000000100adf620 php`zend_error_va_list(type=2,
error_filename="/private/tmp/php-crash-preload-error_handler/vendor/google/apiclient/src/aliases.php",
error_lineno=64, format="Can't preload already declared class %s",
args="ؿF\U00000006\U00000001") at zend.c:1380:8
    frame #18: 0x0000000100add888 php`zend_error_at(type=2,
filename="/private/tmp/php-crash-preload-error_handler/vendor/google/apiclient/src/aliases.php",
lineno=64, format="Can't preload already declared class %s") at zend.c:1483:2
    frame #19: 0x0000000107c21ce4 opcache.so`preload_link at ZendAccelerator.c:3809:5
    frame #20: 0x0000000107c1d9fc
opcache.so`accel_preload(config="/tmp/php-crash-preload-error_handler/index.php") at
ZendAccelerator.c:4503:4
    frame #21: 0x0000000107c18058 opcache.so`accel_finish_startup at ZendAccelerator.c:4830:8
    frame #22: 0x0000000107c14ee8 opcache.so`accel_post_startup at ZendAccelerator.c:3059:9
    frame #23: 0x0000000100adbbb8 php`zend_post_startup at zend.c:1009:7
    frame #24: 0x0000000100909c80 php`php_module_startup(sf=0x00000001017b3ae0,
additional_modules=0x0000000000000000, num_additional_modules=0) at main.c:2397:6
    frame #25: 0x0000000100e0f108 php`php_cli_startup(sapi_module=0x00000001017b3ae0) at
php_cli.c:410:6
    frame #26: 0x0000000100e0b80c php`main(argc=7, argv=0x000000016fdff078) at php_cli.c:1327:6

------------------------------------------------------------------------
[2021-08-12 17:56:21] mike@php.net

Sorry, read "4th parameter" as if 0-indexed -- i.e. as errcontext (5th param)

------------------------------------------------------------------------
[2021-08-12 17:46:25] mike@php.net

Description:
------------
Probable ingredients:

* preloading
* big set of files to cache
* strict_types
* error_handler receiving NULL as 4th parameter
* monolog

Test script:
---------------
git clone https://github.com/m6w6/php-crash-preload-error_handler
cd php-crash-preload-error_handler
composer install
./run.sh



------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=81353&edit=1


Thread (10 messages)

« previous php.bugs (#235836) next »