optimizely / optimizely/java-sdk
[BUG] If configuration file initialization fails, the configuration file remains uninitialized indefinitely
还没有人认领这个 Issue。
- 主要语言
- Java
- 星标
- 44
- 派生
- 32
- 平均合并
- 8 小时 39 分钟
- 30 天内合并 PR
- 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 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
调研方向
从 core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java 开始,重点查看第 95–121 行附近对 HttpStatus.SC_NOT_MODIFIED 的处理。跟踪 PollingProjectConfigManager 在 HTTP 304 之后如何初始化并轮询 currentProjectConfig。即使响应为 304,失败的启动也能在后续轮询期间初始化配置,即表示完成。
由索引模型根据 Issue 内容生成。
评估
- 技术栈
- java
- 领域
- backend
- Issue 类型
- 缺陷
- 难度
- 2/5
- 预计耗时
- 1-3 小时
- 活跃度
- 停滞
- 描述清晰度
- 描述清楚
- 新手友好度
- 55/100