Hacktoberfest 2026: los issues que los mantenedores marcaron para octubre, abiertos y aptos para principiantes. Explorar issues de Hacktoberfest

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

Abierto Apto para principiantes
#8,295 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Los mantenedores suelen responder en 1 día

Nadie ha tomado este issue todavía.

Evaluación

Dificultad
2/5
Tiempo estimado
1-3 horas
Aptitud para principiantes
68/100
Tipo de issue
Error
Claridad
Bien especificado
Estado de actividad
Activo
Stack tecnológico
python
Área
backend

Línea de trabajo

Empieza leyendo AsyncContentCache y CacheKeys.path / CacheKeys.method, y después revisa las pruebas unitarias existentes sobre el comportamiento de las claves de caché. Añade una prueba unitaria que envíe la misma ruta con dos cadenas de consulta y compruebe que cada una obtiene su propia respuesta; la tarea está terminada cuando la segunda respuesta no se sirve desde la entrada de caché de la primera consulta.

Escrito por el modelo de indexación a partir del texto del issue.

Descripción

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.

Lenguaje dominante
Python
Estrellas
619
Forks
176
Merge medio
16 h 49 min
PR fusionados (30 d)
126

Preparar el entorno

Primeros pasos

  1. Lee el issue completo y luego la guía de contribución del proyecto.
  2. Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
  3. Haz un fork del repositorio y trabaja en una rama.
  4. Abre un pull request que haga referencia al número del issue.

Más de pulp/pulpcore

Todos los issues de pulp/pulpcore

Issues similares

Más issues de Python

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.