Container listing cache includes every .meta sidecar, doubling its size
Maintainer thường phản hồi trong vòng 1 ngày
Đánh giá
- Độ khó
- 4/5
- Thời gian dự kiến
- 3-5 ngày
- Mức phù hợp với người mới
- 57/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức độ hoạt động
- Sôi nổi
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
Start with src/Assets/AssetContainerContents.php, especially all(), metaFilesIn(), ensureMissingDirectoriesExist(), add(), and forget(); trace callers in AssetContainer.php, AssetsMetaClean.php, and Asset.php. Run the relevant tests in tests/Assets/AssetContainerContentsTest.php, including root, folder, recursive, and orphan-cleanup cases. Done means cached listings exclude .meta entries while meta-file lookups and cleanup still work.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Bug description
AssetContainerContents::all() (src/Assets/AssetContainerContents.php:31) caches the raw recursive Flysystem listing of the container, including every .meta/*.yaml sidecar. With cache_meta enabled each asset has one, so roughly half of the cached listing is meta files that nothing reads through the listing: Asset::meta() reads them by path via disk()->get($this->metaPath()), and filteredFilesIn() filters them back out for every consumer.
Only two callers want them: metaFilesIn() (src/Assets/AssetContainerContents.php:179), used by AssetContainer::metaFiles() for assets:meta-clean and folder deletion, and Asset::metaExists() (src/Assets/Asset.php:316).
Real numbers from one site: 197,603 entries in the listing, 99,944 of them .meta yaml. The cached key is 80 MB serialized and loading it exhausts a 1 GB PHP-FPM worker.
How to reproduce
- S3 container with
cache_metaon and a large number of assets. - Warm the listing (
AssetContainer::find('x')->files()). - Inspect the cached
asset-list-contents-<handle>value: half the entries are under.meta/.
Logs
Allowed memory size of 1073741824 bytes exhausted (tried to allocate 80320709 bytes) at vendor/laravel/framework/src/Illuminate/Redis/Connections/Connection.php:124
Environment
Statamic 6.35.0, Laravel 11, PHP 8.3, Redis cache, S3 (Flysystem v3) container.
Installation
Existing Laravel app
Additional details
Suggested fix: drop .meta paths from the cached listing in all() (filter in the remember callback, next to normalizeFlysystemAttributes()), and have metaFilesIn() list <folder>/.meta directly from the filesystem on demand instead of filtering files(). ensureMissingDirectoriesExist() should not synthesize .meta directory entries either.
Callers to check: AssetContainer::metaFiles() / metaFilesIn() (src/Assets/AssetContainer.php:376), AssetsMetaClean (src/Console/Commands/AssetsMetaClean.php:85), Asset::metaExists(), and AssetContainerContents::add() / forget() which currently insert meta paths into the list on write.
Tests in tests/Assets/AssetContainerContentsTest.php (or wherever the listing is covered): cached listing contains no .meta entries; metaFilesIn() still returns the right files for root, a folder, and recursive; assets:meta-clean still finds orphaned meta. Existing filteredFilesIn() tests should pass unchanged.
Related: #11998 moves meta off the container disk entirely, which would make this moot for sites that opt in, but the default layout still benefits. Companion issue: Asset::exists() loading the full listing.
- Ngôn ngữ chính
- PHP
- Star
- 4.9k
- Fork
- 647
- Merge trung bình
- 1 ngày 45 phút
- Pull request đã merge (30 ngày)
- 221
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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.
Issue khác của statamic/cms
-
forms ui
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
accessibility
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 74/100
Maintainer thường phản hồi trong vòng 1 ngày
-
antlers
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 66/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Nav: link to the site root with an anchor (/#section) gets is_parent on every pageCó thể đã có người làm @duncanmcclean đã nhận hôm nay. Đang mởnavigations
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Multiple Choice and Checkboxes no longer offer "Inline", but the default views still use itCó thể đã có người làm @duncanmcclean đã nhận hôm nay. Đang mởforms
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 35/100
Maintainer thường phản hồi trong vòng 1 ngày
Issue tương tự
-
sync-en
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 86/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Selection on a line without a docblock tag drops trailing characters (data provider attribute)Đang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 82/100
vimeo/psalm#15150 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 83/100
taskforcesh/bullmq#5238 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
[Bug] v-change-database-password reports success but doesn't change the password when MySQL validate_password rejects itCó thể đã có người làm @bfs2021 đã nhận hôm nay. Đang mởbug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 76/100
Automattic/jetpack#55517 ·
Maintainer thường phản hồi trong vòng 1 ngày