Cache evection of HTTP Client lead to not closed HttpClients
まだ誰も着手していません。
評価
- 難易度
- 5/5
- 見積もり時間
- 1週間以上
- 初心者へのやさしさ
- 32/100
- issue の種類
- バグ
- 明瞭さ
- おおむね明確
- 活発さ
- 停滞
- 技術スタック
- java
- 領域
- networking
調査の方向性
リンクされたキャッシュ構築箇所の DefaultApacheHttpClient5Cache.java から始め、issue 755 の議論を確認してください。長時間実行される操作や非同期操作中に、プールされた CloseableHttpClients がどのように作成、キャッシュ、排除、使用されるかを追跡してください。排除されたクライアントが、まだ使用中のクライアントを中断せずにクローズされれば完了です。
索引モデルが issue の本文から書いたものです。
説明
Describe the Bug
The current implementation of caching and evicting an HTTP Client lead to not closed HttpClients.
Technically the HttpClients are CloseableHttpClient and should / need(specifically for pooled connections) to be closed after usage.
(See also this discussion)
In the current code-base, when a HttpClient with a PoolingHttpClientConnectionManager is created, it's not cleaned up properly on eviction.
The following workaround does not work in all cases:
cache = Caffeine.newBuilder().expireAfterAccess(duration, unit).ticker(ticker).evictionListener((key, value, cause) -> {
if (value instanceof CloseableHttpClient closeableHttpClient) {
try {
closeableHttpClient.close();
} catch (final Exception e) {
log.warn("Failed to close HttpClient. Ignoring the exception and continue.", e);
}
}
}).build();
There are two basic scenarios:
- The client was created and is no longer in use and the eviction time triggers the cleanup. ✅
- The client was created and in still in use (long running operation, async operation, ...) and the eviction time triggers the cleanup. Then the
evictionListenerwould kill the connection underneath. ❌
Steps to Reproduce
Code review.
Expected Behavior
Proper closing of HttpClients.
Screenshots
No response
Used Versions
Current state in main.
Code Examples
// Your code here
Stack Trace
No response
Log File
Log file
...Affected Development Phase
Development
Impact
No Impact
Timeline
No response
- 主要言語
- Java
- スター
- 41
- フォーク
- 33
- 平均マージ
- 18時間 34分
- マージ済み PR(30日)
- 19
コントリビューションガイド
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- issue 番号を参照したプルリクエストを送ります。
SAP/cloud-sdk-java のほかの issue
-
bug
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
SAP/cloud-sdk-java#1280 · コメント 1 件 ·
-
bug
SAP/cloud-sdk-java#1270 · コメント 3 件 · 担当者 1 名 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 48/100
SAP/cloud-sdk-java#1268 · コメント 1 件 ·
-
難易度 4/5 3〜5日 初心者へのやさしさ 45/100
SAP/cloud-sdk-java#1250 ·
-
ZeroTrustIdentityService does not configure svidPicker, causing non-deterministic SVID selection オープンbug
難易度 3/5 1〜2日 初心者へのやさしさ 70/100
SAP/cloud-sdk-java#1243 · コメント 2 件 ·
SAP/cloud-sdk-java の issue をすべて見る
似ている issue
-
難易度 2/5 1〜3時間 初心者へのやさしさ 65/100
-
bug
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
elastic/gradle-plugins#157 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
cryptomator/hub#497 ·
-
難易度 2/5 1〜3時間 初心者へのやさしさ 75/100
johanhaleby/occurrent#1120 ·