Skip to content

OkHttpGrpcSender.shutdown() does not properly await executor thread termination #7827

@kevinburkesegment

Description

@kevinburkesegment

Describe the bug

The OkHttpGrpcSender.shutdown() method returns a CompletableResultCode that completes immediately, even though HTTP dispatcher threads are still running in the background. This
violates the semantic contract of CompletableResultCode, where callers expect to use .join() to wait for async operations to fully complete.

Steps to reproduce

Create an OkHttpGrpcSender, make some HTTP requests to trigger thread creation, call shutdown().join(), then enumerate running threads. HTTP dispatcher threads will still be alive
despite the shutdown completing successfully.

What did you expect to see?

I expected .join() to wait for all threads to complete

What did you see instead?

HTTP dispatcher threads are still alive.

What version and what artifacts are you using?

opentelemetry-java version 79f8691

Environment

I believe I can reproduce on all environments, but mainly for the moment, Mac with these options


Gradle 9.2.0

Build time: 2025-10-29 13:53:23 UTC
Revision: d9d6bbce03b3d88c67ef5a0ff31f7ae5e332d6bf

Kotlin: 2.2.20
Groovy: 4.0.28
Ant: Apache Ant(TM) version 1.10.15 compiled on August 25 2024
Launcher JVM: 21.0.9 (Homebrew 21.0.9)
Daemon JVM: /opt/homebrew/Cellar/openjdk@21/21.0.9/libexec/openjdk.jdk/Contents/Home (no JDK specified, using current Java home)
OS: Mac OS X 15.6 aarch64

Additional context

I have a patch prepared but wanted to be complete and file an issue for discussion as well.

Metadata

Metadata

Assignees

No one assigned

    Labels

    BugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions