Skip to content
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

[Bug]: OpenTelemetry log error occurred. cannot send message to batch processor as the channel is closed #1660

Open
NickLarsenNZ opened this issue Apr 11, 2024 · 1 comment
Labels
bug Something isn't working triage:todo Needs to be traiged.

Comments

@NickLarsenNZ
Copy link

NickLarsenNZ commented Apr 11, 2024

What happened?

When Tokio shuts down, I receive a lot of errors about a channel being closed:
This happens whether or not I attempt to shutdown (unset) the trace/log providers.

Here is a brief explanation as code:

#[tokio::main]
async fn main() {
    // initialise tracing/logging here

    opentelemetry::global::shutdown_tracer_provider();
    opentelemetry::global::shutdown_logger_provider();

    // Without this sleep, I get a different error:
    // OpenTelemetry log error occurred. Exporter otlp encountered the following errors: the grpc server returns error (Unknown error): , detailed error message: transport error
    tokio::time::sleep(Duration::from_secs(2)).await;

    // errors are printed at this point.
}

For a full (hopefully) reproducable version of the code and dependencies, see: https://gist.github.com/NickLarsenNZ/fbbb477230e9992e9a4aa2603edcf54f

I initially raised it in the #otel-rust Slack channel: https://cloud-native.slack.com/archives/C03GDP0H023/p1712590806651679

API Version

0.22.0

SDK Version

0.22.1

What Exporters are you seeing the problem on?

OTLP

Relevant log output

OpenTelemetry log error occurred. cannot send message to batch processor as the channel is closed.
@NickLarsenNZ NickLarsenNZ added bug Something isn't working triage:todo Needs to be traiged. labels Apr 11, 2024
@TommyCpp
Copy link
Contributor

The batch log processor has a background task that exporting the logs. When it's being droped the receiver in the background task will gets dropped too.

After this operation, every attempt to emit logs will result in such error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working triage:todo Needs to be traiged.
Projects
None yet
Development

No branches or pull requests

2 participants