Heap growth during stream reconnects, stale-cache retention, and SDK lifecycle defects
Chưa có ai nhận issue này.
Đánh giá
- Độ khó
- 5/5
- Thời gian dự kiến
- Hơn một tuần
- Mức phù hợp với người mới
- 18/100
- Loại issue
- Lỗi
- Độ rõ ràng
- Cần làm rõ
- Mức độ hoạt động
- Sôi nổi
- Công nghệ
- java
- Lĩnh vực
- backend, performance
Hướng nghiên cứu
The report bundles several separate defects, so pick one reproduction rather than the whole issue. The stale-cache case starts at the full-refresh upsert path in the repository; the XML case starts at StorageRepository backed by XmlFileMapStore, where Properties rejects non-string values. Run the synthetic 100-flag, 20-segment test to confirm the retained counts before changing anything. Done means one reproduction now passes with a matching test, and the issue is split so the production memory question is tracked separately.
Do mô hình lập chỉ mục viết ra từ nội dung của issue.
Mô tả
We investigated memory growth in a production Java service using the Harness Feature Flags SDK through a relay proxy. Stream disconnects and HTTP 503 retries coincided with increases in old-generation heap usage.
Separately, controlled tests against official SDK 1.9.3 reproduced stale-cache retention and several other defects. We have not established that these defects caused the production memory growth.
Production observations come from application and relay logs plus JVM metrics. Controlled SDK reproductions use official version 1.9.3. Service and infrastructure identifiers below are anonymized.
Production timeline
On 6 November 2026, both replicas of service-a lost their stream connections almost simultaneously. All times below are WIB, UTC+7.
| Time | Observed event |
|---|---|
| 07:36:34.735 | Relay writer logs that its upstream Harness SSE stream disconnected. |
| 07:36:35.052 | Relay writer publishes DISCONNECTED to its read replicas. |
| 07:36:35.071–07:36:35.078 | Both application pods report SSE stream disconnected, reason: End of SSE stream. |
| 07:36:35.413 | Pod B receives its first HTTP 503 from the relay stream endpoint. Polling has started with a 60-second interval. |
| 07:36:38.867 | Relay writer logs HTTP/2 GOAWAY, ErrCode=NO_ERROR, debug="max_age", with a 60-second retry delay. |
| 07:36:45.193–07:37:34.020 | Pod B records three more HTTP 503 responses. Its four retry delays are approximately 9.76, 19.52, 29.28, and 39.04 seconds. |
| 07:37:42.875 | Relay writer reconnects upstream and publishes the connected state. |
| 07:38:09.497 | Pod A reconnects. |
| 07:38:13.070 | Pod B reconnects successfully after five attempts. |
The relay’s upstream disconnection lasted approximately 68 seconds. Application stream recovery took approximately 94–98 seconds.
The logs identify the relay interruption and subsequent retries. They do not identify which upstream component initiated the connection-age termination.
Memory around this event
Old-generation heap usage increased across the same interval:
| JVM | 07:34 WIB | 07:40 WIB | Increase |
|---|---|---|---|
| Pod A | 294.35 MiB | 396.01 MiB | 101.66 MiB |
| Pod B | 260.29 MiB | 340.46 MiB | 80.17 MiB |
These are per-JVM sampled metrics, not deployment totals or matched post-GC measurements. The saved range metrics use five-minute maxima, so they show the surrounding increase rather than its exact allocation time.
From 5 November at 19:00 WIB to 6 November at 10:00 WIB, Pod B’s container working set increased from 527.07 MiB to 848.04 MiB. Its committed Java heap increased from 133.5 MiB to 412.5 MiB. Committed heap and container working set are different measurements and should not be added together.
Similar shared stream disconnects occurred on:
- 5 November, 22:42:17 WIB: both pods reconnected by 22:42:48.
- 6 November, 01:53:50 WIB: both pods reconnected by 01:55:20.
- 6 November, 04:00:42 WIB: both pods disconnected and reconnected within the same second.
There is also evidence against interpreting all of this growth as retained live objects. On 5 November, between the 20:20 and 20:25 WIB samples, a natural major GC reduced Pod A’s old-generation usage from 377.57 MiB to 54.68 MiB, without a process restart. No further major GC appeared in the saved counters through 6 November at 10:00 WIB.
The production data therefore establishes a time correlation between reconnect activity and heap growth. It does not distinguish temporary refresh allocations from a retention defect.
Controlled reproduction: missed deletions survive reconnect
The following separate test reproduces stale-cache retention in official SDK 1.9.3, using synthetic data and a local HTTP/SSE server:
- Initialize a streaming client with 100 flags and 20 segments, each containing 1,000 synthetic target entries.
- Disconnect the stream.
- Replace 99 flag identifiers and all 20 segment identifiers on the server.
- Reconnect without delivering the deleted objects’ stream events.
- Return complete lists containing only the current flags and segments.
- Repeat and inspect repository contents and heap usage after full GC.
Expected: a successful complete refresh leaves 100 flags and 20 segments.
Actual: full refreshes upsert returned objects but retain absent identifiers. After 10 cycles, the SDK retained 1,090 flags and 220 segments. Post-GC used heap increased from 10.73 MiB to 45.12 MiB.
The default cache has an entry limit. This demonstrates stale retention and additional heap usage, not an unlimited entry count. Missed deletions have not been established in the production incident above.
Additional findings reproduced on SDK 1.9.3
| Area | Reproduction and observed behavior |
|---|---|
| Retry cancellation | Stop a stream while its request receives HTTP 503 responses. The interceptor continues retrying the canceled call and retains its worker. Later attempts can fail locally without reaching the relay. |
| Segment membership | Segment entry customer-12345 incorrectly matches target 123. Both inclusion and exclusion checks use substring matching. |
| Stream ordering | Block a version 2 patch fetch, process a version 3 delete, then release the fetch. The older patch restores the deleted flag. |
| Analytics retention | Three successful batches of 40,000 distinct targets leave 120,000 target objects in static history after close. |
| Analytics delivery | A failed upload still marks target metadata as delivered. One client’s history can also suppress another client’s metadata. |
| Response cleanup | Malformed SSE data triggers the disconnect callback without closing the tracked response body. This does not establish a permanent socket leak in every reconnect path. |
| XML persistence | Store a FeatureConfig through StorageRepository backed by XmlFileMapStore, then close it. Serialization throws ClassCastException because Properties requires string values. |
| Shutdown | An in-flight poll can write after storage closes. Separately, a storage-close exception prevents subsequent connector cleanup. |
| Queue capacity | With update fetches blocked, 500 further messages remain queued in an effectively unbounded executor queue. This is a backlog capacity risk, not a demonstrated OOM. |
The analytics findings require analytics to be enabled. The XML finding concerns the optional XML store.
These controlled reproductions use synthetic identifiers, mocked connectors, or a loopback HTTP server. They establish specific SDK behaviors independently of the production memory observations.
- Ngôn ngữ chính
- Java
- Star
- 6
- Fork
- 22
- Chỉ số merge pull request
- Không có pull request nào được merge trong 30 ngày
Chuẩn bị môi trường
Dự án này không cung cấp dev container, Dockerfile hay hướng dẫn đóng góp, nên bạn cần tự thiết lập môi trường: hãy bắt đầu từ README và xem hướng dẫn đóng góp lần đầu của chúng tôi để biết các bước chung.
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.
Issue khác của harness/ff-java-server-sdk
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 25/100
harness/ff-java-server-sdk#215 · 1 bình luận ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 30/100
harness/ff-java-server-sdk#212 ·
-
Độ khó 3/5 1-2 ngày Mức phù hợp với người mới 35/100
harness/ff-java-server-sdk#142 ·
Tất cả issue của harness/ff-java-server-sdk
Issue tương tự
-
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
NucleusFramework/Nucleus#1020 ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
ajeetraina/awesome-docker-sbx#839 ·
-
bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 72/100
portfolio-performance/portfolio#6459 ·
Maintainer thường phản hồi trong vòng 2 ngày
-
Bug
Độ khó 2/5 1-3 giờ Mức phù hợp với người mới 75/100
bufbuild/protovalidate-java#564 · 1 reaction ·
Maintainer thường phản hồi trong vòng 1 ngày
-
Độ khó 1/5 Dưới một giờ Mức phù hợp với người mới 83/100
it-at-m/traegerportal#17 ·