[php-src] Issue #9879: [PHP 8.0.25] Occasional segmentation faults while autoloading
| From: | mszabo-wikia | Date: | Wed, 02 Nov 2022 19:02:46 +0000 |
| Subject: | [php-src] Issue #9879: [PHP 8.0.25] Occasional segmentation faults while autoloading | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-242736@lists.php.net to get a copy of this message | ||
Issue: https://github.com/php/php-src/issues/9879
Author: mszabo-wikia
### Description
Hello,
After upgrading to PHP 8.0.25 from PHP 7.3.33, our PHP-FPM deployment experiences occasional
segmentation faults. I unfortunately do not yet have a consistent reproducer, as the occurrence rate
is rather low (66 events in ~8h at ~8K rps).
Some example backtraces follow. So far, all segfaults seem to have occurred in string manipulation
functions while a class was being autoloaded:
```
#0 zend_mm_alloc_small (bin_num=4, heap=0x7f08eb200040) at /usr/src/php/Zend/zend_alloc.c:1255
#1 zend_mm_alloc_heap (size=<optimized out>, heap=0x7f08eb200040) at
/usr/src/php/Zend/zend_alloc.c:1326
#2 _emalloc (size=<optimized out>) at /usr/src/php/Zend/zend_alloc.c:2540
#3 0x00005650aa8de7c5 in zend_string_alloc (persistent=false, len=<optimized out>) at
/usr/src/php/Zend/zend_string.h:144
#4 zend_string_init (persistent=false, len=<optimized out>, str=0x42380fef
"PageStoreRecord")
at /usr/src/php/Zend/zend_string.h:166
#5 zend_string_init_fast (len=<optimized out>, str=0x42380fef "PageStoreRecord") at
/usr/src/php/Zend/zend_string.h:176
#6 zif_substr (execute_data=0x7f08eb214010, return_value=0x7f08eb213fe0) at
/usr/src/php/ext/standard/string.c:2209
#7 0x0000000060fa9504 in ?? ()
#8 0x0000000000000000 in ?? ()
```
---
```
#0 zend_mm_alloc_small (bin_num=4, heap=0x7f6882400040) at /usr/src/php/Zend/zend_alloc.c:1255
#1 zend_mm_alloc_heap (size=<optimized out>, heap=0x7f6882400040) at
/usr/src/php/Zend/zend_alloc.c:1326
#2 _emalloc (size=<optimized out>) at /usr/src/php/Zend/zend_alloc.c:2540
#3 0x000055e9dd8d3188 in zend_string_alloc (persistent=false, len=9) at
/usr/src/php/Zend/zend_string.h:144
#4 zend_string_init (persistent=false, len=9, str=0x7f6882490900 "Wikimedia\\") at
/usr/src/php/Zend/zend_string.h:166
#5 php_trim_int (mode=2, what_len=<optimized out>, what=<optimized out>,
str=<optimized out>)
at /usr/src/php/ext/standard/string.c:824
#6 php_do_trim (mode=2, return_value=0x7f68824142b0, execute_data=<optimized out>) at
/usr/src/php/ext/standard/string.c:855
#7 zif_rtrim (execute_data=<optimized out>, return_value=0x7f68824142b0) at
/usr/src/php/ext/standard/string.c:869
#8 0x0000000061095a36 in ?? ()
#9 0x0000000000000001 in ?? ()
#10 0x00007f68824d5108 in ?? ()
#11 0x00007f68824d5001 in ?? ()
#12 0x00007f68824d5001 in ?? ()
#13 0x00007f6882490a01 in ?? ()
#14 0x01007f6882490a01 in ?? ()
#15 0x00007f68823f5400 in accel_shared_globals () from
/usr/local/lib/php/extensions/no-debug-non-zts-20200930/opcache.so
#16 0x00007f68823f5400 in accel_shared_globals () from
/usr/local/lib/php/extensions/no-debug-non-zts-20200930/opcache.so
#17 0x0000000000000082 in ?? ()
#18 0x000000004524cde8 in ?? ()
#19 0x0000000000000000 in ?? ()
```
----
```
#0 zend_mm_alloc_small (bin_num=7, heap=0x7fdf7f200040) at /usr/src/php/Zend/zend_alloc.c:1255
#1 zend_mm_realloc_heap (copy_size=<optimized out>, use_copy_size=false, size=<optimized
out>, ptr=0x7fdf7f255930,
heap=0x7fdf7f200040) at /usr/src/php/Zend/zend_alloc.c:1567
#2 _erealloc (ptr=0x7fdf7f255930, size=<optimized out>) at
/usr/src/php/Zend/zend_alloc.c:2561
#3 0x00005624dade6227 in zend_string_extend (persistent=false, len=39, s=0x7fdf7f255930)
at /usr/src/php/Zend/zend_string.h:241
#4 ZEND_CONCAT_SPEC_TMPVAR_TMPVAR_HANDLER () at /usr/src/php/Zend/zend_vm_execute.h:16071
#5 0x00005624dae1853b in execute_ex (ex=0x7fdf7f255930) at
/usr/src/php/Zend/zend_vm_execute.h:56799
#6 0x00005624dadaa294 in zend_call_function (fci=<optimized out>, fci_cache=0x7ffe0e8ebc30)
at /usr/src/php/Zend/zend_execute_API.c:895
#7 0x00005624dadaa6b5 in zend_call_known_function (fn=0x45c592b8, object=<optimized out>,
called_scope=<optimized out>,
retval_ptr=retval_ptr@entry=0x0, param_count=param_count@entry=1,
params=params@entry=0x7ffe0e8ebce0, named_params=0x0)
at /usr/src/php/Zend/zend_execute_API.c:985
#8 0x00005624dac8a0c0 in spl_perform_autoload (class_name=0x42c1a040, lc_name=0x7fdf7f2675ff)
at /usr/src/php/ext/spl/php_spl.c:440
#9 0x00005624dada9450 in zend_lookup_class_ex (name=<optimized out>, key=key@entry=0x0,
flags=flags@entry=0)
at /usr/src/php/Zend/zend_execute_API.c:1110
#10 0x00005624dada95f9 in zend_lookup_class (name=<optimized out>) at
/usr/src/php/Zend/zend_execute_API.c:1125
#11 0x00005624dadcdd11 in class_exists_impl (execute_data=0x7fdf7f213f80,
return_value=0x7fdf7f213f70, flags=8, skip_flags=3)
at /usr/src/php/Zend/zend_builtin_functions.c:1038
#12 0x00005624dae1b155 in ZEND_DO_ICALL_SPEC_RETVAL_USED_HANDLER () at
/usr/src/php/Zend/zend_vm_execute.h:1295
#13 execute_ex (ex=0x7fdf7f255930) at /usr/src/php/Zend/zend_vm_execute.h:55162
#14 0x00005624dae20a9f in zend_execute (op_array=0x7fdf7f26f000, return_value=0x0)
at /usr/src/php/Zend/zend_vm_execute.h:59522
--Type <RET> for more, q to quit, c to continue without paging--
#15 0x00005624dadb7d35 in zend_execute_scripts (type=2132885216, type@entry=8,
retval=retval@entry=0x0,
file_count=file_count@entry=3) at /usr/src/php/Zend/zend.c:1694
#16 0x00005624dad53d50 in php_execute_script (primary_file=primary_file@entry=0x7ffe0e8ee420)
at /usr/src/php/main/main.c:2545
#17 0x00005624daadda6d in main (argc=<optimized out>, argv=<optimized out>) at
/usr/src/php/sapi/fpm/fpm/fpm_main.c:1914
```
## Opcache configuration
```
opcache.memory_consumption=512;
opcache.interned_strings_buffer=64;
opcache.max_accelerated_files=20000;
opcache.validate_timestamps=0;
opcache.jit_buffer_size=128M;
```
## Installed extensions
```
[PHP Modules]
apcu
bz2
calendar
Core
ctype
curl
date
dom
excimer
exif
fileinfo
filter
ftp
gd
hash
iconv
igbinary
intl
json
libxml
luasandbox
mailparse
mbstring
memcached
mustache
mysqli
mysqlnd
openssl
pcntl
pcre
PDO
pdo_pgsql
pdo_sqlite
Phar
posix
readline
redis
Reflection
session
SimpleXML
sockets
sodium
SPL
sqlite3
standard
tidy
tokenizer
wikidiff2
xml
xmlreader
xmlwriter
Zend OPcache
zlib
[Zend Modules]
Zend OPcache
```
Thank you in advance.
### PHP Version
PHP 8.0.25
### Operating System
Debian Bullseye-based container image on Ubuntu Bionic guest