Opcache prevents file from being added to realpath cache?
まだ誰も着手していません。
- 主要言語
- C
- スター
- 40.4k
- フォーク
- 8.1k
- 平均マージ
- 2日 13時間
- マージ済み PR(30日)
- 96
説明
Description
realpath cache is a per process cache
opcache is a shared cache
opcache is enabled with validation 2 seconds
foo.php contains:
<?php $t = time();
bar.php contains:
$path = '../foo.php';
require_once $path;
echo $t;
var_dump( realpath_cache_get() );
with php-fpm request bar.php multiple times.
when checking realpath_cache_get() we see foo.php is added to the realpath cache
as soon as opcache has cached this require once foo.php, foo.php is removed from realpath cache - for most worker processes.
Questions:
-
opcache seems to be able to clear the realpath cache for some (?) workers - how is opcache able to do that? or does this happen on every request separately? (how come that foo.php is still in realpath cache for some workers though?)
-
no matter what (
is_file,realpath,...) calls with../foo.phpwill never make it populate realpath cache again with this file, once it's in opcache - even when calling clearstatcache before it because the file is potentially deleted beforehand. It always seems to fetch the full path again from disk instead of storing it in realpath?
PHP Version
8.3
Operating System
No response
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
opcache の検証を有効にした状態で、require_once、realpath_cache_get()、is_file()、realpath()、clearstatcache() を使用し、php-fpm 上で foo.php と bar.php による動作を再現する。worker プロセス間で結果を比較し、opcache と realpath-cache の相互作用を追跡する。異なるキャッシュ内容とキャッシュの再投入に失敗する理由を説明できるか、確認済みの修正を特定できれば完了とする。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- c, php
- 領域
- backend, performance
- issue の種類
- バグ
- 難易度
- 4/5
- 見積もり時間
- 3〜5日
- 活発さ
- 停滞
- 明瞭さ
- 説明が足りない
- 初心者へのやさしさ
- 30/100