Content cache is cleared when a repository version is started, so concurrent requests re-cache the previous version
Maintainer thường phản hồi trong vòng 1 ngày
Một pull request liên quan đã được merge.
- #8247 của @aevnsvi — đã merge
Đá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
- 42/100
Hướng nghiên cứu
Start with Repository.new_version() and RepositoryVersion.__exit__ in pulpcore, then check the cache invalidation tests and how distributions serve repository content. Trace when a version is committed and when the response cache is cleared; done means concurrent requests cannot leave the previous version cached after the version task completes.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
Version
pulpcore main (0f6df7d), with the content cache enabled (CACHE_ENABLED = True, Redis).
Describe the bug
Repository.new_version() clears the response cache of the distributions serving the repository when the new version is started. The version only becomes complete later, in RepositoryVersion.__exit__. In between, those distributions are still served from the previous version. A request that arrives in that window puts the previous answer back into the freshly cleared cache. It is then served until the entry expires (CACHE_SETTINGS["EXPIRES_TTL"], 600 seconds by default), although the new version exists by then. Nothing clears the cache again when the version completes.
Without concurrent requests the invalidation works, which makes this easy to miss in a test. Under real traffic, an upload is invisible for up to the full TTL.
To Reproduce
It shows most clearly where an index is served through the cache, for example the pulp_python simple API:
- Create a Python repository and a distribution for it, with the cache enabled.
- Keep a few clients polling
GET /pypi/<base_path>/simple/<name>/, every half second or so. - Upload a new package, or a new version of an existing one, into the repository and wait for the task.
- The polling clients keep getting the index without the new file for about ten minutes.
I ran this three times each for a new name and a new version, with four clients polling. The old index stayed cached in every run, and also with a single client. With the cache disabled nothing is stale, so the race is in the invalidation, not in the version itself.
Expected behavior
After the task that creates a repository version has finished, the distributions serving that repository answer from the new version.
Additional context
- The cache can be cleared once the version is complete and committed instead: in
RepositoryVersion.__exit__, throughtransaction.on_commit. A version that changes nothing is discarded, and would then no longer clear the cache at all. - Publications already invalidate after
complete=Trueis saved, so they are not affected. - Deleting a version needs no change: a version that a distribution serves is protected from deletion.
- #2026 is about Redis outages, a different case.
I have a patch with unit tests, and can open it as a PR.
- Ngôn ngữ chính
- Python
- Star
- 619
- Fork
- 176
- Merge trung bình
- 16 giờ 51 phút
- Pull request đã merge (30 ngày)
- 117
Chuẩn bị môi trường
- Không có Dockerfile hay tệp Docker Compose
- Có mẫu pull request
- Đọc 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.
Issue khác của pulp/pulpcore
-
Reclaim Space Server ErrorĐang mởIssue
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Feature
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 62/100
pulp/pulpcore#5802 · 10 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 42/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Issue
Độ khó 4/5 3-5 ngày Mức phù hợp với người mới 45/100
Maintainer thường phản hồi trong vòng 1 ngày
-
Content app answers 404 instead of 502 when the remote of on-demand content is unavailableCó thể đã có người làm @gigi206 đã nhận 14 ngày trước. Đang mở
Độ khó 3/5 Nửa ngày Mức phù hợp với người mới 66/100
pulp/pulpcore#8217 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
Tất cả issue của pulp/pulpcore
Issue tương tự
-
parse names a key after a top-level multi() threshold Bitcoin Core v31.1 refuses as not validĐang mở
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 78/100
btclib-org/btclib-wallet#587 · 1 bình luận ·
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 68/100
Judgment-Pack/judgment-pack-spec#275 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
ai-generated
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 77/100
Maintainer thường phản hồi trong vòng 1 ngày
-
documentation good first issue priority: low size: XS
Độ khó 1/5 1-3 giờ Mức phù hợp với người mới 92/100
yeongseon/azure-functions-doctor-python#651 ·
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 65/100
Changaco/python-libarchive-c#146 ·