optimizely / optimizely/java-sdk
[BUG] If configuration file initialization fails, the configuration file remains uninitialized indefinitely
まだ誰も着手していません。
- 主要言語
- Java
- スター
- 44
- フォーク
- 32
- 平均マージ
- 8時間 39分
- マージ済み PR(30日)
- 1
説明
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
PollingProjectConfigManagerthe connection is broken, or there is a time out, or an error. =>PollingProjectConfigManager.currentProjectConfigis empty. - 5min later,
PollingProjectConfigManager.poll()polls the config file, but receives HTTP 304 from Optimizely =>PollingProjectConfigManager.currentProjectConfigremains empty. - 5min later, still no modification on the configuration =>
PollingProjectConfigManager.currentProjectConfigremains empty. PollingProjectConfigManager.currentProjectConfigis 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
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
調査の方向性
core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java から始め、特に 95–121 行付近の HttpStatus.SC_NOT_MODIFIED の処理を確認してください。HTTP 304 の後に PollingProjectConfigManager が currentProjectConfig をどのように初期化してポーリングするかを追跡してください。HTTP 304 が返された場合でも、失敗した起動によって後のポーリング中に設定を初期化できれば完了です。
索引モデルが issue の本文から書いたものです。
評価
- 技術スタック
- java
- 領域
- backend
- issue の種類
- バグ
- 難易度
- 2/5
- 見積もり時間
- 1〜3時間
- 活発さ
- 停滞
- 明瞭さ
- 明確に書かれている
- 初心者へのやさしさ
- 55/100