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

WorkloadIdentityHttpClient can leak its delegate when auth cleanup throws

Đang mở
#882 0 bình luận 0 reaction 0 người được giao Xem trên GitHub

Chưa có ai nhận issue này.

Đánh giá

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

Hướng nghiên cứu

Bắt đầu bằng cách tìm WorkloadIdentityHttpClient.close() và so sánh luồng dọn dẹp của nó với mẫu AuthenticatingHttpClient tương ứng. Thêm kiểm thử hồi quy cho lỗi xác thực kèm dọn dẹp delegate, lỗi từ cả hai tài nguyên có suppression và dọn dẹp thông thường; hoàn tất khi cả hai tài nguyên đều được thử xử lý và lỗi đầu tiên được giữ lại.

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

Mô tả

Description

WorkloadIdentityHttpClient.close() currently closes workloadIdentityAuth before closing its delegate:

override fun close() {
    workloadIdentityAuth?.close()
    delegate.close()
}

If the configured workload-identity provider throws from close(), execution never reaches delegate.close().

This differs from the sibling AuthenticatingHttpClient, which deliberately attempts both cleanup operations and preserves the first failure while suppressing a second one.

Impact

A custom SubjectTokenProvider may implement AutoCloseable and fail during cleanup. In that case the underlying HTTP client can remain open, retaining transports, connection pools, executors, or other resources.

Expected behavior

Closing the wrapper should always attempt to close both owned resources. If both fail, the first failure should be propagated and the second retained as a suppressed exception.

Suggested fix

Use the same failure-preserving cleanup pattern already used by AuthenticatingHttpClient, with workload-identity cleanup attempted first and delegate cleanup guaranteed afterward.

Add regression coverage for:

  • auth cleanup fails, delegate still closes;
  • both cleanup operations fail, delegate failure is suppressed on the auth failure;
  • normal close still closes both resources.
Ngôn ngữ chính
Kotlin
Star
1.5k
Fork
264
Merge trung bình
13 giờ 51 phút
Pull request đã merge (30 ngày)
113

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

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 openai/openai-java

Tất cả issue của openai/openai-java

Issue tương tự

Thêm issue về Kotlin

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.