Heap growth during stream reconnects, stale-cache retention, and SDK lifecycle defects
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 18/100
- issue の種類
- バグ
- 明瞭さ
- 説明が足りない
- 活発さ
- 活発
- 技術スタック
- java
- 領域
- backend, performance
調査の方向性
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.
索引モデルが issue の本文から書いたものです。
説明
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.
- 主要言語
- Java
- スター
- 6
- フォーク
- 22
- PR マージ指標
- 30日以内にマージされた PR はありません
環境構築
このプロジェクトには開発コンテナ、Dockerfile、コントリビューションガイドがありません。まず README を読み、一般的な手順ははじめてのコントリビューションガイドを参照してください。
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
harness/ff-java-server-sdk のほかの issue
-
難易度 3/5 1〜2日 初心者へのやさしさ 25/100
harness/ff-java-server-sdk#215 · コメント 1 件 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 30/100
harness/ff-java-server-sdk#212 ·
-
難易度 3/5 1〜2日 初心者へのやさしさ 35/100
harness/ff-java-server-sdk#142 ·
harness/ff-java-server-sdk の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
NucleusFramework/Nucleus#1020 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
ajeetraina/awesome-docker-sbx#839 ·
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 72/100
portfolio-performance/portfolio#6459 ·
メンテナーはふだん 2 日以内に返信
-
Bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
bufbuild/protovalidate-java#564 · リアクション 1 件 ·
メンテナーはふだん 1 日以内に返信
-
難易度 1/5 1時間未満 初心者へのやさしさ 83/100
it-at-m/traegerportal#17 ·