php / php/php-src

Segfault

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

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

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

説明

Description

PHP config: https://paste.daniil.it/config

gdb backtrace:

(gdb) backtrace
#0  0x0000561fa234fd48 in ZEND_INIT_NS_FCALL_BY_NAME_SPEC_CONST_HANDLER () at ./Zend/zend_vm_execute.h:56188
#1  execute_ex (ex=0x7fbe32a15630) at ./Zend/zend_vm_execute.h:56188
#2  0x0000561fa2354701 in zend_execute (op_array=0x7fbe32a7e000, return_value=0x0) at ./Zend/zend_vm_execute.h:60396
#3  0x0000561fa22e1e55 in zend_execute_scripts (type=type@entry=8, retval=retval@entry=0x0, file_count=file_count@entry=3) at ./Zend/zend.c:1827
#4  0x0000561fa227d3fa in php_execute_script (primary_file=<optimized out>) at ./main/main.c:2542
#5  0x0000561fa23cb50a in do_cli (argc=9, argv=0x561fa37bd170) at ./sapi/cli/php_cli.c:964
#6  0x0000561fa210dc5b in main (argc=9, argv=0x561fa37bd170) at ./sapi/cli/php_cli.c:1333

zbacktrace:

(gdb) zbacktrace
[0x7fbe32a15570] Zoon\Cache\Provider\Redis->getRedisClient() /zoon/zoon/vendor/zoon/cache/src/Provider/Redis.php:69
[0x7fbe32a15400] Zoon\Cache\Provider\Redis->getInternal("system_load_v2:z216:local_load", "") /zoon/zoon/vendor/zoon/cache/src/Provider/Redis.php:151
[0x7fbe32a15320] Zoon\Cache\Provider\CacheProvider->get("system_load_v2:z216:local_load", "") /zoon/zoon/vendor/zoon/cache/src/Provider/CacheProvider.php:144
// more stuff

Redis.php:69 is weird, because it points to the array_key_exists in closeRedisConnection, not the getRedisClient function mentioned in the backtrace, which by the way have the following code

        private function getRedisClient(): RedisClient {
                $pid = getmypid();
                $serverKey = "{$pid}:{$this->params['host']}:{$this->params['port']}";
                if (!array_key_exists($serverKey, self::$instances)) {
                        self::$instances[$serverKey] = new RedisClient(
                                $this->params['host'],
                                $this->params['port'],
                                $this->params['database'],
                                $this->params['connect_timeout'],
                                $this->params['max_reconnect'] ?? 0,
                        );
                }

                return self::$instances[$serverKey];
        }

        private function closeRedisConnection() {
                $pid = getmypid();
                $serverKey = "{$pid}:{$this->params['host']}:{$this->params['port']}";
                if (array_key_exists($serverKey, self::$instances)) {
                        try {
                                self::$instances[$serverKey]->close();
                        } catch (\Throwable $e) {
                                trigger_error($e->getMessage(), E_USER_WARNING);
                        } finally {
                                unset(self::$instances[$serverKey]);
                        }
                }
        }

Feel free to tag me if further inspection of the coredump is neeed.

ref: compressed_coredump-php.113283.1688702030

PHP Version

PHP 8.2.7

Operating System

Ubuntu 20.04, ondrej repos

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

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

はじめの一歩

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

調査の方向性

gdb と zbacktrace のデータ、特に Zend/zend_vm_execute.h:56188、main/main.c:2542、vendor/zoon/cache/src/Provider/Redis.php:69 から調査を始め、参照されている圧縮 coredump が利用可能であれば調査してください。segfault の再現可能な原因を特定し、回帰テストまたはその他の検証済みの修正を追加すれば完了です。

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

評価

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

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

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