Opcache prevents file from being added to realpath cache?
Dieses Issue hat noch niemand übernommen.
- Vorherrschende Sprache
- C
- Sterne
- 40.4k
- Forks
- 8.1k
- Ø Merge
- 2 T. 13 Std.
- Gemergte PRs (30 T.)
- 96
Beschreibung
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
Beitragsleitfaden
Erste Schritte
- Lies das ganze Issue und danach den Beitragsleitfaden des Projekts.
- Schreib ins Issue, dass du es übernimmst — das erspart doppelte Arbeit.
- Forke das Repository und arbeite in einem Branch.
- Öffne einen Pull Request, der die Issue-Nummer nennt.
Rechercherichtung
Reproduziere das Verhalten mit foo.php und bar.php unter php-fpm unter Verwendung von require_once, realpath_cache_get(), is_file(), realpath() und clearstatcache(), während die opcache-Validierung aktiviert ist. Vergleiche die Ergebnisse über Worker-Prozesse hinweg und verfolge die Interaktion zwischen opcache und realpath-cache; als abgeschlossen gilt die Aufgabe, wenn die unterschiedlichen Cache-Inhalte und das Fehlschlagen der erneuten Befüllung des Cache erklärt sind oder ein bestätigter Fix identifiziert wurde.
Vom Indexierungsmodell aus dem Issue-Text verfasst.
Bewertung
- Tech-Stack
- c, php
- Bereich
- backend, performance
- Issue-Typ
- Bug
- Schwierigkeit
- 4/5
- Geschätzter Aufwand
- 3-5 Tage
- Aktivitätsstatus
- Veraltet
- Klarheit
- Muss geklärt werden
- Anfängerfreundlichkeit
- 30/100