php / php/php-src

PHP-FPM segfault in OPcache with PHP 8.4.10

オープン
#19,125 コメント 26 件 リアクション 0 件 担当者 0 名 GitHub で見る

まだ誰も着手していません。

Bug Extension: opcache Status: Needs Triage
主要言語
C
スター
40.4k
フォーク
8.2k
平均マージ
2日 13時間
マージ済み PR(30日)
96

説明

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

コントリビューションガイド

コントリビューションガイドを開く

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

調査の方向性

PHP 8.4.10 の coredump と、zend_file_cache_script_store() および persistent_compile_file() 周辺の OPcache フレームから始めてください。2 つ目のトレースには tideways.so の tideways_hooks_perform_autoload() も含まれています。利用可能な GDB バックトレースを使って、失敗している OPcache パスを絞り込み、再現可能なケースを探してください。原因が確認され、回帰テストまたは文書化された修正があれば完了です。

索引モデルが issue の本文から書いたものです。

評価

技術スタック
c, php
領域
backend, performance
issue の種類
バグ
難易度
5/5
見積もり時間
1週間以上
活発さ
停滞
明瞭さ
説明が足りない
初心者へのやさしさ
25/100

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。