php / doc-en

English PHP documentation
488 stars 724 forks source link

opcache.file_cache should be purged after PHP updates #1931

Open phil-lipp opened 1 year ago

phil-lipp commented 1 year ago

Description

After recently updating php and its modules to 8.1.12 I'm getting Segmentation fault when trying to execute my Nextcloud occ command.

The following code:

sudo -u www-data php /var/www/nextcloud/occ app:update --all

Resulted in this output:

Segmentation fault

But I expected this output instead:

No Segmentation fault

This is the Backtrace:

(gdb) run /var/www/nextcloud/occ app:update --all
Starting program: /usr/bin/php /var/www/nextcloud/occ app:update --all
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/aarch64-linux-gnu/libthread_db.so.1".

Program received signal SIGSEGV, Segmentation fault.
0x0000007ff4f270cc in ?? () from /usr/lib/php/20210902/opcache.so
(gdb) bt
#0  0x0000007ff4f270cc in ?? () from /usr/lib/php/20210902/opcache.so
php/php-src#1  0x00000055558c87b4 in zend_do_link_class ()
php/php-src#2  0x00000055557fab7c in zend_bind_class_in_slot ()
php/php-src#3  0x00000055557fac40 in do_bind_class ()
php/php-src#4  0x000000555585d370 in ?? ()
php/php-src#5  0x000000555589734c in execute_ex ()
php/php-src#6  0x00000055558134ac in zend_call_function ()
php/php-src#7  0x00000055558138c4 in zend_call_known_function ()
php/php-src#8  0x000000555570d1f4 in ?? ()
php/php-src#9  0x000000555581272c in zend_lookup_class_ex ()
php/php-src#10 0x0000005555813cfc in zend_fetch_class_by_name ()
php/php-src#11 0x00000055558c86c4 in zend_do_link_class ()
php/php-src#12 0x00000055557fab7c in zend_bind_class_in_slot ()
php/php-src#13 0x00000055557fac40 in do_bind_class ()
php/php-src#14 0x000000555585d370 in ?? ()
php/php-src#15 0x000000555589734c in execute_ex ()
php/php-src#16 0x00000055558134ac in zend_call_function ()
php/php-src#17 0x00000055558138c4 in zend_call_known_function ()
php/php-src#18 0x000000555570d1f4 in ?? ()
php/php-src#19 0x000000555581272c in zend_lookup_class_ex ()
php/php-src#20 0x0000005555813cfc in zend_fetch_class_by_name ()
php/php-src#21 0x00000055558c82ac in zend_do_link_class ()
php/php-src#22 0x00000055557fab7c in zend_bind_class_in_slot ()
php/php-src#23 0x000000555585fa3c in ?? ()
php/php-src#24 0x00000055558973d0 in execute_ex ()
php/php-src#25 0x00000055558134ac in zend_call_function ()
php/php-src#26 0x00000055558138c4 in zend_call_known_function ()
php/php-src#27 0x000000555570d1f4 in ?? ()
php/php-src#28 0x000000555581272c in zend_lookup_class_ex ()
php/php-src#29 0x0000005555813cfc in zend_fetch_class_by_name ()
php/php-src#30 0x00000055558c82ac in zend_do_link_class ()
--Type <RET> for more, q to quit, c to continue without paging--
php/php-src#31 0x00000055557fab7c in zend_bind_class_in_slot ()
php/php-src#32 0x00000055557fac40 in do_bind_class ()
php/php-src#33 0x000000555585d370 in ?? ()
php/php-src#34 0x000000555589734c in execute_ex ()
php/php-src#35 0x00000055558134ac in zend_call_function ()
php/php-src#36 0x00000055558138c4 in zend_call_known_function ()
php/php-src#37 0x000000555570d1f4 in ?? ()
php/php-src#38 0x000000555581272c in zend_lookup_class_ex ()
php/php-src#39 0x0000005555813cfc in zend_fetch_class_by_name ()
php/php-src#40 0x0000005555868194 in ?? ()
php/php-src#41 0x00000055558975b0 in execute_ex ()
php/php-src#42 0x00000055558a26bc in zend_execute ()
php/php-src#43 0x00000055558229c8 in zend_execute_scripts ()
php/php-src#44 0x00000055557bbc3c in php_execute_script ()
php/php-src#45 0x000000555591505c in ?? ()
php/php-src#46 0x0000005555659850 in ?? ()
php/php-src#47 0x0000007ff774ae18 in __libc_start_main (main=0x5555659530, argc=4, argv=0x7ffffff678, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=<optimized out>) at ../csu/libc-start.c:308
php/php-src#48 0x0000005555659a70 in _start ()
Backtrace stopped: previous frame identical to this frame (corrupt stack?)

Installed packages (using php -r "echo implode(',', get_loaded_extensions());"):

Core,date,libxml,openssl,pcre,zlib,filter,hash,json,pcntl,Reflection,SPL,session,standard,sodium,mysqlnd,PDO,xml,bcmath,bz2,calendar,ctype,curl,dom,mbstring,FFI,fileinfo,ftp,gd,gettext,gmp,iconv,igbinary,imagick,intl,ldap,exif,mysqli,pdo_mysql,pdo_sqlite,Phar,posix,readline,redis,shmop,SimpleXML,sockets,sqlite3,sysvmsg,sysvsem,sysvshm,tokenizer,xmlreader,xmlwriter,xsl,zip,Zend OPcache

Packages and their versions (using apt list --installed | grep php):

php-common/bullseye,bullseye,now 2:93+0~20221029.44+debian11~1.gbpaae3e9 all [installed,automatic]
php-json/bullseye,bullseye,now 2:8.1+93+0~20221029.44+debian11~1.gbpaae3e9 all [installed]
php8.1-bcmath/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-bz2/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-cli/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-common/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-curl/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-fpm/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-gd/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-gmp/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-igbinary/bullseye,now 3.2.6+2.0.8-6+0~20220131.33+debian11~1.gbp1d540e arm64 [installed,automatic]
php8.1-imagick/bullseye,now 3.6.0-4+0~20220117.35+debian11~1.gbp149f82 arm64 [installed]
php8.1-intl/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-ldap/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-mbstring/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-mysql/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-opcache/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-readline/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed,automatic]
php8.1-redis/bullseye,now 5.3.7+4.3.0-1+0~20220330.42+debian11~1.gbp6fe8b7 arm64 [installed]
php8.1-sqlite3/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-xml/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1-zip/bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 arm64 [installed]
php8.1/bullseye,bullseye,now 8.1.12-1+0~20221028.28+debian11~1.gbpc35f51 all [installed]

PHP Version

PHP 8.1.12

Operating System

Debian 11

cmb69 commented 1 year ago

If you're using opcache.file_cache, purge the cache and restart the server. Does that segfault still happen (probably yes, but it's worth a try).

phil-lipp commented 1 year ago

If you're using opcache.file_cache, purge the cache and restart the server. Does that segfault still happen (probably yes, but it's worth a try).

Thanks for the reply. I tried running php -r "opcache_reset();" but the segmentation fault persists. Or is there another (maybe more thorough) way of purging the cache?

cmb69 commented 1 year ago

Or is there another (maybe more thorough) way of purging the cache?

Yeah. Just check the value of opcache.file_cache; if it is the path of a directory, just remove all files from that directory.

phil-lipp commented 1 year ago

Or is there another (maybe more thorough) way of purging the cache?

Yeah. Just check the value of opcache.file_cache; if it is the path of a directory, just remove all files from that directory.

That worked - thanks a lot!

cmb69 commented 1 year ago

That worked - thanks a lot!

Oh, wow! So probably something we should document regarding opcache.file_cache.