Opcache prevents file from being added to realpath cache?
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- C
- Star
- 40.4k
- Fork
- 8.1k
- Merge trung bình
- 2 ngày 13 giờ
- Pull request đã merge (30 ngày)
- 96
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Tái hiện hành vi với foo.php và bar.php trên php-fpm, sử dụng require_once, realpath_cache_get(), is_file(), realpath() và clearstatcache(), trong khi bật xác thực opcache. So sánh kết quả giữa các tiến trình worker và theo dõi tương tác giữa opcache và realpath-cache; được xem là hoàn thành khi giải thích được nội dung cache khác nhau và việc không thể nạp lại cache, hoặc xác định được một bản sửa lỗi đã được xác nhận.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- c, php
- Lĩnh vực
- backend, performance
- Loại issue
- Lỗi
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Cần làm rõ
- Mức phù hợp với người mới
- 30/100