optimizely / optimizely/java-sdk

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

Ouverte
#574 0 commentaires 0 réactions 0 personnes assignées Voir sur GitHub

Personne n'a encore pris cette issue.

bug
Langage dominant
Java
Étoiles
44
Forks
32
Merge moyen
8 h 39 min
PR mergées (30 j)
1

Description

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

Guide de contribution

Ouvrir le guide de contribution

Par où commencer

  1. Lisez l'issue en entier, puis le guide de contribution du projet.
  2. Signalez en commentaire que vous la prenez — cela évite que deux personnes fassent le même travail.
  3. Forkez le dépôt et travaillez sur une branche.
  4. Ouvrez une pull request qui référence le numéro de l'issue.

Piste de recherche

Commencez dans core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java, en particulier sur la gestion de HttpStatus.SC_NOT_MODIFIED autour des lignes 95–121. Suivez la manière dont PollingProjectConfigManager initialise et interroge currentProjectConfig après un HTTP 304. Le travail est terminé lorsqu’un démarrage ayant échoué peut initialiser la configuration lors d’un sondage ultérieur, même lorsque la réponse est 304.

Rédigé par le modèle d'indexation à partir du texte de l'issue.

Évaluation

Stack technique
java
Domaine
backend
Type d'issue
Bug
Difficulté
2/5
Temps estimé
1-3 heures
Activité
À l'abandon
Clarté
Clairement spécifiée
Accessibilité débutants
55/100

Recevez les nouvelles issues par e-mail

Un résumé court des issues GitHub adaptées aux débutants.