optimizely / optimizely/java-sdk
[BUG] If configuration file initialization fails, the configuration file remains uninitialized indefinitely
Chưa có ai nhận issue này.
- Ngôn ngữ chính
- Java
- Star
- 44
- Fork
- 32
- Merge trung bình
- 8 giờ 39 phút
- Pull request đã merge (30 ngày)
- 1
Mô tả
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
Hướng dẫn đóng góp
Bắt đầu từ đâu
- Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
- Bình luận trên issue rằng bạn sẽ nhận — tránh hai người làm cùng một việc.
- Fork repository và làm thay đổi trên một nhánh.
- Mở pull request có tham chiếu số hiệu của issue.
Hướng nghiên cứu
Bắt đầu trong core-httpclient-impl/src/main/java/com/optimizely/ab/config/HttpProjectConfigManager.java, đặc biệt là phần xử lý HttpStatus.SC_NOT_MODIFIED quanh các dòng 95–121. Theo dõi cách PollingProjectConfigManager khởi tạo và polling currentProjectConfig sau HTTP 304. Hoàn thành khi một lần khởi động thất bại vẫn có thể khởi tạo cấu hình trong một lần polling sau đó, ngay cả khi phản hồi là 304.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Đánh giá
- Công nghệ
- java
- Lĩnh vực
- backend
- Loại issue
- Lỗi
- Độ khó
- 2/5
- Thời gian dự kiến
- 1-3 giờ
- Mức độ hoạt động
- Đình trệ
- Độ rõ ràng
- Đặc tả rõ ràng
- Mức phù hợp với người mới
- 55/100