Content cache ignores the query string, so one path serves the response cached for another query
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
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
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de pulp/pulpcore
-
Reclaim Space Server ErrorAbiertoIssue
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 1 día
-
Feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
pulp/pulpcore#5802 · 10 comentarios ·
Los mantenedores suelen responder en 1 día
-
Issue Triage-Needed
Dificultad 3/5 1-2 días Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
Issue
Dificultad 4/5 3-5 días Aptitud para principiantes 42/100
Los mantenedores suelen responder en 1 día
-
Issue
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
Todos los issues de pulp/pulpcore
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 86/100
-
Validate finite output clamping limits in StepPredictor.prepare_clamping_params to prevent silent NaN/Inf propagationPosiblemente ocupada @muskan-creates352 la tomó hoy. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 84/100
mllam/neural-lam#848 ·
Los mantenedores suelen responder en 2 días
-
infra
Dificultad 1/5 Menos de una hora Aptitud para principiantes 88/100
fab-geocommuns/RNB-coeur#1166 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
deepspeedai/DeepSpeed#8951 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 76/100
aws/context-ontology-accelerator#343 ·
Los mantenedores suelen responder en 1 día