Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

Content cache ignores the query string, so one path serves the response cached for another query

オープン 初心者向け
#8,295 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 1 日以内に返信

まだ誰も着手していません。

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
68/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
python
領域
backend

調査の方向性

まず AsyncContentCache と CacheKeys.path / CacheKeys.method を読み、キャッシュキーの動作に関する既存のユニットテストを確認します。同じパスに2つのクエリ文字列を付けて送信し、それぞれに個別のレスポンスが返ることを確認するユニットテストを追加します。2つ目のレスポンスが1つ目のクエリのキャッシュエントリから返されなければ完了です。

索引モデルが issue の本文から書いたものです。

説明

Version
pulpcore 3.120.0, also on main; CACHE_ENABLED = True.

Describe the bug
AsyncContentCache keys its entries on the request path and method only
(CacheKeys.path, CacheKeys.method); the query string is not part of the key. The
content app's answer can depend on the query string, though: pull-through caching
passes the request to Remote.get_remote_artifact_url(), and pulp_python takes the
upstream URL from its redirect parameter. Two requests for one path that differ only
in the query string share a cache entry, and the second is answered with whatever the
first one cached, until the entry expires.

What we saw
pulp_python 3.36.2, a pull-through distribution backed by a repository. Two CI jobs
installed the same package, not cached yet, within about a second of each other. From
the content app's access log, all four requests for the same path
.../uv-0.11.6-py3-none-manylinux_2_17_x86_64.manylinux2014_x86_64.whl:

client query response
1 job A redirect=<upstream>.whl.metadata 200, metadata (12 kB)
2 job A redirect=<upstream>.whl 200, the wheel (25 MB), saved
3 job B redirect=<upstream>.whl.metadata 200, metadata (12 kB)
4 job B redirect=<upstream>.whl 200, 12 kB, in 67 ms

Request 4 got the metadata that request 3 had put into the cache under the wheel's
path, and pip failed with THESE PACKAGES DO NOT MATCH THE HASHES. A few minutes later
the same link served the wheel again. The .metadata lands in the query string because
pip builds the PEP 658 URL by appending .metadata to the whole link.

To Reproduce
The interleaving above depends on timing. The key itself can be shown directly: wrap a
handler that answers with its query string in AsyncContentCache and request one path
with two query strings; the second request is a cache hit with the first one's answer.

Expected behavior
A request is never answered with an entry cached for a different query string.

Additional context
Adding the query string to the default keys of AsyncContentCache fixes it; a change
with a unit test is on
https://github.com/AVSystem/pulpcore/tree/fix-cache-key-query-string, and we can open
it as a pull request if this is the direction you want. Requests without a query string
keep one entry each, so ordinary content is cached as before; requests carrying a
per-request value in the query (a signed URL) would get an entry each.

pulp_python has its own part in this (a pull-through link announces metadata that pip
then asks for at the package's path), which we are reporting there.

主要言語
Python
スター
619
フォーク
176
平均マージ
16時間 49分
マージ済み PR(30日)
126

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

pulp/pulpcore のほかの issue

pulp/pulpcore の issue をすべて見る

似ている issue

Python の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。