php / php/php-src

PHP-FPM segfault in OPcache with PHP 8.4.10

Ouverte
#19,125 26 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

Bug Extension: opcache Status: Needs Triage
Langage dominant
C
Étoiles
40.4k
Forks
8.1k
Merge moyen
2 j 13 h
PR mergées (30 j)
96

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez par les coredumps de PHP 8.4.10 et les frames d’OPcache autour de zend_file_cache_script_store() et persistent_compile_file() ; la deuxième trace inclut également tideways_hooks_perform_autoload() de tideways.so. Utilisez les backtraces GDB disponibles pour circonscrire le chemin OPcache en échec et rechercher un cas reproductible. C’est terminé lorsqu’une cause confirmée est établie avec un test de régression ou un correctif documenté.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
c, php
Domaine
backend, performance
Type d'issue
Bug
Difficulté
5/5
Temps estimé
Plus d'une semaine
Activité
À l'abandon
Clarté
À clarifier
Accessibilité débutants
25/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.