optimizely / optimizely/java-sdk

[BUG] If configuration file initialization fails, the configuration file remains uninitialized indefinitely

Abierto
#574 0 comentarios 0 reacciones 0 asignados Ver en GitHub

Nadie ha tomado este issue todavía.

bug
Lenguaje dominante
Java
Estrellas
44
Forks
32
Merge medio
8 h 39 min
PR fusionados (30 d)
1

Descripción

Is there an existing issue for this?
  • I have searched the existing issues
SDK Version

3.2.0-alpha to 4.2.2.
Since this commit: Update HttpProjectConfigManager to use Last-Modified time (https://github.com/optimizely/java-sdk/pull/292)

Current Behavior

If the initialization of the configuration file fails, the configuration file remains un-initilialized indefinitely until the server/pod is restarted, or the configuration gets updated on Optimizely platform.

Expected Behavior

If the configuration file cannot be initialized at server start-up (eg: because Optimizely is down or takes to much time to respond), then during the next configuration poll, the configuration should be updated, even if Optimizely returns an HTTP 304 (Not Modified) code.

Steps To Reproduce
  • At initialization of the PollingProjectConfigManager the connection is broken, or there is a time out, or an error. => PollingProjectConfigManager.currentProjectConfig is empty.
  • 5min later, PollingProjectConfigManager.poll() polls the config file, but receives HTTP 304 from Optimizely => PollingProjectConfigManager.currentProjectConfig remains empty.
  • 5min later, still no modification on the configuration => PollingProjectConfigManager.currentProjectConfig remains empty.
  • PollingProjectConfigManager.currentProjectConfig is never initialized (except if a modification on the configuration is done on Optimizely side, or the server is restarted).
Java Version

No response

Link

No response

Logs

No response

Severity

Affecting users

Workaround/Solution

See the HttpProjectConfigManager:
https://github.com/optimizely/java-sdk/blob/746e81530a9224fabcd7f610d81800358e6e34c9/core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java#L95-L121

Here, the condition handling the HttpStatus.SC_NOT_MODIFIED should check if the currentProjectConfig is initialized or not. If it is empty, it means the configuration file has never been initialized properly and the configuration should thus be returned.

Recent Change

No response

Conflicts

No response

Guía de contribución

Abrir la guía de contribución

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.

Línea de trabajo

Empieza en core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java, especialmente en el manejo de HttpStatus.SC_NOT_MODIFIED alrededor de las líneas 95–121. Sigue cómo PollingProjectConfigManager inicializa y consulta currentProjectConfig después de un HTTP 304. Se considera terminado cuando un inicio fallido puede inicializar la configuración durante un sondeo posterior incluso cuando la respuesta es 304.

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

Evaluación

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

Recibe los nuevos issues en tu correo

Un resumen breve de issues de GitHub para principiantes.