Hacktoberfest 2026:メンテナが10月に向けて印を付けた、オープンで初心者向けの issue。 Hacktoberfest の issue を見る

JdkHttpSender does not close the response body on unsupported Content-Encoding

クローズ 初心者向け
#8,960 コメント 0 件 リアクション 0 件 担当者 0 名 GitHub で見る

メンテナーはふだん 2 日以内に返信

関連するプルリクエストがすでにマージされています。

  • #8962 @thswlsqls による — マージ済み

評価

難易度
2/5
見積もり時間
1〜3時間
初心者へのやさしさ
76/100
issue の種類
バグ
明瞭さ
明確に書かれている
活発さ
活発
技術スタック
java
領域
backend

調査の方向性

JdkHttpSender.toHttpResponse()から始め、未対応のContent-EncodingのチェックとBodyHandlers.ofInputStream()周辺のレスポンスボディ処理を追ってください。issueがボディを閉じると指摘しているOkHttpHttpSender.handleResponse()と比較してください。未対応のエンコーディングで引き続きUnsupportedContentEncodingExceptionが発生し、レスポンスボディが閉じられれば完了です。issueではテストファイルは指定されていません。

索引モデルが issue の本文から書いたものです。

説明

Describe the bug
When a response has a Content-Encoding other than gzip or identity, JdkHttpSender.toHttpResponse() throws UnsupportedContentEncodingException without closing the response body InputStream.

Steps to reproduce

  1. Configure an OTLP HTTP exporter with the JDK sender (opentelemetry-exporter-sender-jdk).
  2. Point it at a server or proxy that answers with Content-Encoding: br, ignoring our Accept-Encoding: gzip, identity.

What did you expect to see?
The export fails with Unsupported Content-Encoding: br and the body is closed, as in OkHttpHttpSender.handleResponse(), which runs the same check inside try (ResponseBody body = response.body()).

What did you see instead?
The body is never closed: the throw comes before try (InputStream rawIs = response.body()). BodyHandlers.ofInputStream() requires the caller to read to EOF or call close() to release the exchange, so if part of the body has not arrived yet, the exchange is never cancelled. The check and ofInputStream() both came in #8224.

What version and what artifacts are you using?
Artifacts: opentelemetry-exporter-otlp, opentelemetry-exporter-sender-jdk
Version: main @ b32298a83
How did you reference these artifacts? N/A

Environment
Compiler: Temurin 21
OS: N/A

Additional context
N/A

主要言語
Java
スター
2.5k
フォーク
1k
平均マージ
2日 23時間
マージ済み PR(30日)
68

環境構築

はじめの一歩

  1. issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
  2. 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
  3. リポジトリをフォークし、ブランチを切って変更します。
  4. issue 番号を参照したプルリクエストを送ります。

open-telemetry/opentelemetry-java のほかの issue

open-telemetry/opentelemetry-java の issue をすべて見る

似ている issue

Java の issue をもっと見る

新しい issue をメールで受け取る

初心者向けの GitHub issue を短くまとめたダイジェスト。