opcache doesn't list all files with the same path when using chroot (opcache_get_status())
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.2k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
The following code:
<?php
echo '<pre>';
print_r(opcache_get_status());
Resulted in this output:
Array
(
[...]
[scripts] => Array
(
[/htdocs/temp.php] => Array
(
[full_path] => /htdocs/temp.php
[...]
)
But I expected this output instead:
Array
(
[...]
[scripts] => Array
(
[(chroot:/home/user1)/htdocs/temp.php] => Array
(
[full_path] => /htdocs/temp.php
[...]
)
[(chroot:/home/user2)/htdocs/temp.php] => Array
(
[full_path] => /htdocs/temp.php
[...]
)
When using opcache.validate_root=1, same paths across different chroot are listed as one file only. There should be multiple keys.
Prefix is hashed using the inode number, which is working fine (so it's not a collision bug!): https://github.com/php/php-src/blob/7f914620193079b42a91eb84451719e4b376702b/ext/opcache/ZendAccelerator.c#L2673
Also the https://github.com/amnuts/opcache-gui/ doesn't work on invalidating those specific files. Don't know if it's related, but it's possible.
PHP Version
PHP 8.2.28 (cli) (built: Mar 13 2025 18:21:38) (NTS)
Copyright (c) The PHP Group
Zend Engine v4.2.28, Copyright (c) Zend Technologies
with Zend OPcache v8.2.28, Copyright (c), by Zend Technologies
Operating System
Debian 12
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
参照されている ext/opcache/ZendAccelerator.c の箇所から始め、opcache.validate_root=1 の場合に opcache_get_status() が scripts のキーをどのように構築するかを追跡します。同一のパスを別々の chroot で使って例を再現し、その後、各 chroot が個別のキーとして現れ、示されている full_path が保持されることを確認します。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- backend, performance
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- おおむね明確
- 初心者へのやさしさ
- 45/100