Readiness stays 500 for 3h after a transient DB error during boot (TrackerScriptCache refresh_all never retried)
Los mantenedores suelen responder en 2 días
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 58/100
Línea de trabajo
Start in lib/plausible/cache.ex with Plausible.Cache.Warmer, refresh/3, and refresh_updated_recently; then inspect system_controller.ex for ready?/1 and the critical-cache checks. Trace how a failed boot refresh is scheduled and how readiness observes an empty TrackerScriptCache. Done means the reported transient startup failure no longer leaves readiness failing until the multi-hour interval elapses, with the relevant behavior covered by the project's existing tests.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
Past Issues Searched
Searched for TrackerScriptCache / tracker_script_cache / readiness; nothing matching.
Version
Community Edition v3.2.1 (also checked master: same code in lib/plausible/cache.ex and system_controller.ex).
What happened
A single transient DB error during boot makes /api/health (readiness) return 500 for 3 hours, while the app otherwise serves traffic fine. Under Kubernetes with the documented health probe this becomes an infinite restart loop.
Sequence, from logs:
- At boot
Plausible.Cache.Warmerrunsrefresh_allfor every cache at once, plus Oban starts. With a 10-connection pool and a DB a few hundred ms away, the pool hitDBConnection.ConnectionError ... queue_timeoutafter ~6s. Plausible.Cache.refresh/3catches that and only logsError refreshing 'tracker_script_cache' - ...(cache.ex ~L233). The cache stays empty.TrackerScriptCacheis in@critical_cachesfor readiness.ready?/1returnsfalsebecausesize() == 0butcount_all() == 9. Readiness responds500 {"sessions":"ok","postgres":"ok","clickhouse":"ok","sites_cache":null}.- The next
refresh_allfortracker_script_cacheis scheduled ~3 hours out (interval 10805730in the warmer init log).refresh_updated_recentlyruns every 30s but only picks up rows updated since the last run, so it never repairs a cache that missed the initial load. - If the deployment's startup/liveness probe points at
/api/health, the pod is killed long before 3h elapse, and the cycle repeats on every boot. I saw 56 consecutive restarts.
Plausible.Site.Cache and Plausible.Shield.IPRuleCache have the same shape but shorter refresh_all intervals (15 min / 3 min), so they self-heal before anyone notices.
Expected
A failed boot-time refresh_all should retry (short backoff) instead of waiting for the next multi-hour cycle, or refresh_updated_recently should fall back to a full refresh while ready?/1 is false.
Workaround
bin/plausible rpc 'Plausible.Site.TrackerScriptCache.refresh_all()' inside the container makes readiness green immediately. For Kubernetes, point startup/liveness at /api/system/health/live and keep /api/health for readiness only.
- Lenguaje dominante
- Elixir
- Estrellas
- 29.7k
- Forks
- 1.9k
- Merge medio
- 3 d 22 h
- PR fusionados (30 d)
- 50
Preparar el entorno
- Incluye un Dockerfile o un 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 plausible/analytics
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 75/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
Los mantenedores suelen responder en 2 días
-
ObanErrorReporter purges imported data when the cleanup worker crashes — silent loss of completed CSV importsPosiblemente ocupada @EmmS21 la tomó hace 96 días. Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 74/100
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
plausible/analytics#5201 · 1 comentario ·
Los mantenedores suelen responder en 2 días
-
Wrong API URL for GTMAbierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 70/100
plausible/analytics#5200 · 2 comentarios ·
Los mantenedores suelen responder en 2 días
Todos los issues de plausible/analytics
Issues similares
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 90/100
MustacheCase/zanadir#403 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
taskforcesh/bullmq#5038 ·
Los mantenedores suelen responder en 1 día
-
pip: same package pinned twice with different casing in pyproject.toml, only the first pin is updatedPosiblemente ocupada @v-abhishekbhaskar la tomó hace 1 día. AbiertoL: python L: ruby:bundler T: bug 🐞
Dificultad 2/5 1-3 horas Aptitud para principiantes 69/100
dependabot/dependabot-core#16756 · 1 asignado ·
Los mantenedores suelen responder en 1 día
-
feat: signup pageAbiertod: medium
Dificultad 2/5 1-3 horas Aptitud para principiantes 65/100
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100