[4.0 P2] T-32 Cache layer robustness
Los mantenedores suelen responder en 1 día
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 30/100
- Tipo de issue
- Error
- Claridad
- Bien especificado
- Estado de actividad
- Activo
- Stack tecnológico
- php
- Área
- performance
Línea de trabajo
Start in src/Instrument/ClassLoading/CachePathManager.php: loadCacheState() at :346-347, the merge loop at :347-368, and the null-cacheDir write at :397 reached by clearCacheState() at :412. Then read src/Instrument/ClassLoading/AopComposerLoader.php:160-164 and src/Instrument/Transformer/WeavingTransformer.php:970-983 for the class-map and function-proxy freshness paths. Run the existing cache path manager tests first. Done means unit tests for a merge after a concurrent write, a missing class-map file, and flushCacheState(true) without a cacheDir.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Part of #665 · Priority: P2 · BC window: no · References are path:line at a5a1504.
Problem
The metadata cache loses entries under concurrency, trusts files that may be missing, can write to the filesystem root, and never forgets deleted sources.
Evidence
src/Instrument/ClassLoading/CachePathManager.php:346-347:loadCacheState()is a no-op once the state is loaded, soflushCacheState()merges into the snapshot taken at the start of the request and overwrites entries that other processes wrote in the meantime.src/Instrument/ClassLoading/AopComposerLoader.php:160-164trusts the class map (added to Composer at:96-98). A missing cached file leads to a failed include instead of re-weaving.src/Instrument/Transformer/WeavingTransformer.php:970-972: function-proxy freshness ignores everything except the file's existence. The content depends on the namespace, the advisors and PHP's internal function list, so a PHP upgrade serves stale proxies. The write at:980-983is also non-atomic (T-05).src/Instrument/ClassLoading/CachePathManager.php:343:|| $forceletsflushCacheState(true)run with a null cacheDir, so:397writes to/_transformation.cache.clearCacheState()(:412) triggers this.src/Instrument/ClassLoading/CachePathManager.php:347-368: entries for deleted sources are never pruned.
Failure scenario
Two concurrent cold requests both flush. The second writes its own snapshot plus its new entries, and the first request's entries are lost, so those classes re-weave on the next request.
Proposed fix
- Re-read the file under an exclusive lock just before merging, then write through
CacheFileWriter. - In production, check
is_fileon a class-map hit (cheap with the stat cache) and fall back to the loader. - Key function proxies by
PHP_VERSION_IDplus the advisor hash. - Return early when cacheDir is null.
- Prune entries whose source is gone during warmup.
Acceptance
- Unit tests covering: a merge after a concurrent write, a missing class-map file, and
flushCacheState(true)without a cacheDir.
Related
T-05, T-21.
- Lenguaje dominante
- PHP
- Estrellas
- 1.7k
- Forks
- 166
- Merge medio
- 19 h 39 min
- PR fusionados (30 d)
- 48
Preparar el entorno
Este proyecto no incluye contenedor de desarrollo, Dockerfile ni guía de contribución, así que la configuración corre por tu cuenta: empieza por su README y consulta nuestra guía para la primera contribución para los pasos generales.
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 goaop/framework
-
Enhancement Performance
Dificultad 5/5 Más de una semana Aptitud para principiantes 35/100
goaop/framework#747 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Enhancement Performance To Be Discussed
Dificultad 3/5 Medio día Aptitud para principiantes 55/100
Los mantenedores suelen responder en 1 día
-
Feature
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
Los mantenedores suelen responder en 1 día
-
Dificultad 5/5 Más de una semana Aptitud para principiantes 5/100
Los mantenedores suelen responder en 1 día
-
Enhancement To Be Discussed
Dificultad 5/5 Más de una semana Aptitud para principiantes 25/100
Los mantenedores suelen responder en 1 día
Todos los issues de goaop/framework
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Los mantenedores suelen responder en 1 día
-
tech-debt
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
landsman/adminer-desktop#206 ·
Los mantenedores suelen responder en 1 día
-
Explosm: Cyanide & Happiness failed with: https://explosm.net/comics/latest#comic resulted in 307Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
RSS-Bridge/rss-bridge#5154 ·
Los mantenedores suelen responder en 1 día
-
[Sync EN] calendar: document the ValueErrors thrown for invalid calendar IDs and dates (#6005)Abiertosync-en
Dificultad 1/5 Menos de una hora Aptitud para principiantes 90/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
iftechfoundation/ifdb#1415 ·
Los mantenedores suelen responder en 1 día