Skip to content

fix(sender-jdk): unwrap CompletionException and UncheckedIOException before passing to onError - #8987

Closed
siddiqueirshad wants to merge 2 commits into
open-telemetry:mainfrom
siddiqueirshad:fix/jdk-http-sender-unwrap-completion-exception
Closed

siddiqueirshad wants to merge 2 commits into
open-telemetry:mainfrom
siddiqueirshad:fix/jdk-http-sender-unwrap-completion-exception

Conversation

@siddiqueirshad

Copy link
Copy Markdown

Description

Fixes #8961

JdkHttpSender.send() executes sendInternal(messageWriter) asynchronously via CompletableFuture.supplyAsync(..., executorService).

When an IOException is encountered during transmission:

  1. supplyAsync catches the thrown UncheckedIOException(e) and completes the stage exceptionally with a CompletionException.
  2. In .whenComplete(...), throwable is a CompletionException wrapping UncheckedIOException wrapping the underlying IOException (such as ConnectException, SocketTimeoutException).
  3. Passing CompletionException directly to onError.accept(throwable) causes HttpExporter to record error.type=java.util.concurrent.CompletionException instead of the actual transport failure type, and masks the true cause in FailedExportException.

In contrast, OkHttpHttpSender passes the unwrapped IOException directly from onFailure to onError.

Solution

In JdkHttpSender.whenComplete, unwrap CompletionException and UncheckedIOException to retrieve the underlying exception before passing it to onError.accept(unwrapped).

Updated JdkHttpSenderTest.send_ioException_callsOnError to assert that errorRef.get() is directly an IOException matching the thrown failure.

@siddiqueirshad
siddiqueirshad requested a review from a team as a code owner October 29, 2026 04:43
@linux-foundation-easycla

Copy link
Copy Markdown

CLA Not Signed

@opentelemetry-pr-dashboard

opentelemetry-pr-dashboard Bot commented Oct 29, 2026 •

Copy link
Copy Markdown

Pull request dashboard status

Closed · refreshed 2026-10-29 21:16 UTC

Status above doesn't look right?
  • Anything look wrong? Report it with what you expected; it helps us improve the dashboard.

@jack-berg

Copy link
Copy Markdown
Member

Duplicate of #8963

@jack-berg jack-berg marked this as a duplicate of #8963 Oct 29, 2026
@jack-berg jack-berg closed this Oct 29, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

JdkHttpSender passes CompletionException instead of the original exception to onError

2 participants