Hacktoberfest 2026: những issue maintainer đã đánh dấu cho tháng Mười, đang mở và phù hợp người mới. Xem issue Hacktoberfest

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

Đã đóng Phù hợp với người mới
#8,960 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Maintainer thường phản hồi trong vòng 2 ngày

Một pull request liên quan đã được merge.

  • #8962 của @thswlsqls — đã merge

Đánh giá

Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức phù hợp với người mới
76/100
Loại issue
Lỗi
Độ rõ ràng
Đặc tả rõ ràng
Mức độ hoạt động
Sôi nổi
Công nghệ
java
Lĩnh vực
backend

Hướng nghiên cứu

Bắt đầu tại JdkHttpSender.toHttpResponse() và theo dõi cách xử lý phần thân phản hồi quanh bước kiểm tra Content-Encoding không được hỗ trợ và BodyHandlers.ofInputStream(). So sánh với OkHttpHttpSender.handleResponse(), nơi issue nêu rằng phần thân được đóng. Công việc hoàn tất khi mã hóa không được hỗ trợ vẫn gây ra UnsupportedContentEncodingException và đóng phần thân phản hồi; issue không nêu tên tệp kiểm thử.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Mô tả

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

Ngôn ngữ chính
Java
Star
2.5k
Fork
1k
Merge trung bình
2 ngày 23 giờ
Pull request đã merge (30 ngày)
68

Chuẩn bị môi trường

Bắt đầu từ đâu

  1. Đọc hết issue, rồi đọc hướng dẫn đóng góp của dự án.
  2. 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.
  3. Fork repository và làm thay đổi trên một nhánh.
  4. Mở pull request có tham chiếu số hiệu của issue.

Issue khác của open-telemetry/opentelemetry-java

Tất cả issue của open-telemetry/opentelemetry-java

Issue tương tự

Thêm issue về Java

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.