opcache doesn't list all files with the same path when using chroot (opcache_get_status())
Nessuno ha ancora preso questa issue.
- Lingua principale
- C
- Stelle
- 40.4k
- Fork
- 8.1k
- Merge medio
- 2g 13h
- PR unite (30g)
- 96
Descrizione
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
Guida per i contributori
Apri la guida per i contributori
Come iniziare
- Leggi tutta la issue e poi la guida ai contributi del progetto.
- Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
- Fai un fork del repository e lavora su un branch.
- Apri una pull request che faccia riferimento al numero della issue.
Direzione di ricerca
Inizia dalla posizione indicata in ext/opcache/ZendAccelerator.c e segui il modo in cui opcache_get_status() costruisce le chiavi di scripts quando opcache.validate_root=1. Riproduci l'esempio con percorsi identici in chroot separati, quindi verifica che ogni chroot appaia come una chiave distinta, mantenendo il full_path mostrato.
Scritto dal modello di indicizzazione a partire dal testo della issue.
Valutazione
- Stack tecnologico
- c, php
- Ambito
- backend, performance
- Tipo di issue
- Bug
- Difficoltà
- 4/5
- Tempo stimato
- 3-5 giorni
- Stato di attività
- Ferma
- Chiarezza
- Abbastanza chiara
- Idoneità per principianti
- 45/100