Skip to content

Logbook Ktor Client has a deadlock if used in pair with Open Telemetry plugin #2062

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
shilenkoalexander opened this issue Apr 10, 2025 · 0 comments
Labels

Comments

@shilenkoalexander
Copy link
Contributor

Description

We use Ktor Client in our gateway together with Logbook and OpenTelemetry plugins.
In case of requesting large files a deadlock appears.
If you remove one of the plugins - it works fine.
I made some investigation, but didn't find how to fix it.

Logbook is stuck here. It waits for new data in body and never ends waiting.
OpenTelemetry is stuck here. It waits for the request to be finished.

I assume that its a problem of the Logbook, but can't be sure. Tell me in case its not - I'll go to the otel guys.

One more thing to consider - the Logbook does this split of channels even if I don't need to log body. Can't be the solution for the deadlock, but a good thing to fix. here

Expected Behavior

Large files can be also fetched using Ktor client + Logbook + OTel

Actual Behavior

Deadlock appears

Possible Fix

I haven't found one

Steps to Reproduce

  1. Clone this repo
  2. Run Application.kt
  3. Run Gateway.kt
  4. Observe the deadlock

Context

Tried to use Ktor Client and log each request using the Logbook client

Your Environment

All the details are in the repo I attached

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant