Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

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

Aperta Adatta ai principianti
#8,295 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
68/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
backend

Direzione di ricerca

Inizia leggendo AsyncContentCache e CacheKeys.path / CacheKeys.method, poi esamina gli unit test esistenti sul comportamento delle chiavi della cache. Aggiungi un unit test che invii lo stesso percorso con due stringhe di query e verifichi che ciascuna riceva una risposta propria; il lavoro è concluso quando la seconda risposta non viene restituita dalla voce della cache della prima query.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

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.

Lingua principale
Python
Stelle
619
Fork
176
Merge medio
16h 49m
PR unite (30g)
126

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di pulp/pulpcore

Tutte le issue di pulp/pulpcore

Issue simili

Altre issue su Python

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.