php / php/php-src

PHP-FPM segfault in OPcache with PHP 8.4.10

Aperta
#19,125 26 commenti 0 reazioni 0 assegnatari Vedi su GitHub

Nessuno ha ancora preso questa issue.

Bug Extension: opcache Status: Needs Triage
Lingua principale
C
Stelle
40.4k
Fork
8.1k
Merge medio
2g 13h
PR unite (30g)
96

Descrizione

Description

Our PHP-FPM crashes at seemingly random moments with an error in OPcache. I am unable to reproduce this locally but have made coredumps on production. They seem to result in 2 distinct backtraces that seem to point to the same error:

[New LWP 46774]
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
Core was generated by `php-fpm: pool www             '.
Program terminated with signal SIGSEGV, Segmentation fault.

(gdb) bt

#0  0x00007f596e4f5b91 in ?? ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#1  0x00007f596e4f72c9 in ?? ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#2  0x00007f596e4f7db0 in zend_file_cache_script_store ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#3  0x00007f596e50a880 in persistent_compile_file ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#4  0x000055afdce6ea46 in compile_filename ()
#5  0x000055afdce01580 in ?? ()
#6  0x000055afdce0f689 in ?? ()
#7  0x000055afdce3bb0d in execute_ex ()
#8  0x000055afdce39f83 in zend_execute ()
#9  0x000055afdcea1a40 in zend_execute_script ()
#10 0x000055afdcd3f085 in php_execute_script_ex ()
#11 0x000055afdca09a5a in ?? ()
#12 0x00007f59715b624a in __libc_start_call_main (main=main@entry=0x55afdca08d10, 
    argc=argc@entry=2, argv=argv@entry=0x7ffe5eb3ef78)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#13 0x00007f59715b6305 in __libc_start_main_impl (main=0x55afdca08d10, argc=2, 
    argv=0x7ffe5eb3ef78, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7ffe5eb3ef68) at ../csu/libc-start.c:360
#14 0x000055afdca0ba31 in _start ()
Program terminated with signal SIGSEGV, Segmentation fault.

(gdb) bt

#0  0x00007f596e4f5b91 in ?? ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#1  0x00007f596e4f72c9 in ?? ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#2  0x00007f596e4f5cb5 in ?? ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#3  0x00007f596e4f64d0 in ?? ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#4  0x00007f596e4f5cb5 in ?? ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#5  0x00007f596e4f7d82 in zend_file_cache_script_store ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#6  0x00007f596e50a880 in persistent_compile_file ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/opcache.so
#7  0x000055afdce6ea46 in compile_filename ()
#8  0x000055afdce01580 in ?? ()
#9  0x000055afdce0f689 in ?? ()
#10 0x000055afdce3bb0d in execute_ex ()
#11 0x000055afdcdeb0cd in zend_call_function ()
#12 0x000055afdcdeb4dd in zend_call_known_function ()
#13 0x000055afdcc61f86 in ?? ()
#14 0x00007f596cc2564b in tideways_hooks_perform_autoload ()
   from /usr/local/lib/php/extensions/no-debug-non-zts-20240924/tideways.so
#15 0x000055afdcdea31e in zend_lookup_class_ex ()
#16 0x000055afdcdeb8e0 in zend_fetch_class_by_name ()
#17 0x000055afdce0cde7 in ?? ()
#18 0x000055afdce3bcd4 in execute_ex ()
#19 0x000055afdce39f83 in zend_execute ()
#20 0x000055afdcea1a40 in zend_execute_script ()
#21 0x000055afdcd3f085 in php_execute_script_ex ()
#22 0x000055afdca09a5a in ?? ()
#23 0x00007f59715b624a in __libc_start_call_main (main=main@entry=0x55afdca08d10, 
    argc=argc@entry=2, argv=argv@entry=0x7ffe5eb3ef78)
    at ../sysdeps/nptl/libc_start_call_main.h:58
#24 0x00007f59715b6305 in __libc_start_main_impl (main=0x55afdca08d10, argc=2, 
    argv=0x7ffe5eb3ef78, init=<optimized out>, fini=<optimized out>, 
    rtld_fini=<optimized out>, stack_end=0x7ffe5eb3ef68) at ../csu/libc-start.c:360
#25 0x000055afdca0ba31 in _start ()

I am out of my league in debugging this myself, and there's little I can change to the setup to narrow it down. Hopefully the backtraces help. If there's any additional context or hint of reproduction steps I can try please let me know.

PHP Version
PHP 8.4.10 (cli) (built: Jul  3 2025 22:57:54) (NTS)
Copyright (c) The PHP Group
Built by https://github.com/docker-library/php
Zend Engine v4.4.10, Copyright (c) Zend Technologies
    with Zend OPcache v8.4.10, Copyright (c), by Zend Technologies
Operating System

No response

Guida per i contributori

Apri la guida per i contributori

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Direzione di ricerca

Inizia con i coredump di PHP 8.4.10 e i frame di OPcache attorno a zend_file_cache_script_store() e persistent_compile_file(); il secondo trace include anche tideways_hooks_perform_autoload() da tideways.so. Usa i backtrace GDB disponibili per restringere il percorso OPcache che fallisce e cercare un caso riproducibile. Il lavoro è concluso quando è stata confermata la causa, con un test di regressione o un fix documentato.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Valutazione

Stack tecnologico
c, php
Ambito
backend, performance
Tipo di issue
Bug
Difficoltà
5/5
Tempo stimato
Più di una settimana
Stato di attività
Ferma
Chiarezza
Da chiarire
Idoneità per principianti
25/100

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.