Skip to content

[Bug]: BatchSpanProcessor panics when experimental-grpc-retry feature is enabled #3432

@Jesse-Bakker

Description

@Jesse-Bakker

What happened?

When the experimental-grpc-retry feature is enabled, a default RetryPolicy is set when using the tonic exporter. However, the exporter thread doesn't have a tokio runtime active (needed because the retry feature uses runtime timers, with a runtime that defaults to tokio) when using the standard BatchSpanProcessor instead of the one gated behind experimental-trace-batch-span-processor-with-async-runtime.

OpenTelemetry API Version (i.e version of opentelemetry crate)

Latest main

OpenTelemetry SDK Version (i.e version of opentelemetry_sdk crate)

Latest main

What Exporter(s) are you seeing the problem on?

OTLP

Relevant log output

there is no reactor running, must be called from the context of a Tokio 1.x runtime

0: tracing_panic::panic_hook
   1: std::panicking::panic_with_hook
   2: std::panicking::panic_handler::{closure#0}
   3: std::sys::backtrace::__rust_end_short_backtrace::<std::panicking::panic_handler::{closure#0}, !>
   4: __rustc::rust_begin_unwind
   5: core::panicking::panic_fmt
   6: <tokio::runtime::scheduler::Handle>::current
   7: tokio::time::sleep::sleep
   8: <opentelemetry_sdk::runtime::Tokio as opentelemetry_sdk::runtime::Runtime>::delay
   9: opentelemetry_otlp::retry::retry_with_backoff::<opentelemetry_sdk::runtime::Tokio, <opentelemetry_otlp::exporter::tonic::trace::TonicTracesClient as opentelemetry_sdk::trace::export::SpanExporter>::export::{closure#0}::{closure#0}, <opentelemetry_otlp::exporter::tonic::trace::TonicTracesClient as opentelemetry_sdk::trace::export::SpanExporter>::export::{closure#0}::{closure#0}::{closure#0}, (), tonic::status::Status, for<'a> fn(&'a tonic::status::Status) -> opentelemetry_otlp::retry::RetryErrorType>::{closure#0}
  10: <std:🧵:local::LocalKey<alloc::sync::Arc<futures_executor::local_pool::ThreadNotify>>>::with::<futures_executor::local_pool::run_executor<core::result::Result<(), opentelemetry_sdk::error::OTelSdkError>, futures_executor::local_pool::block_on<<opentelemetry_otlp::span::SpanExporter as opentelemetry_sdk::trace::export::SpanExporter>::export::{closure#0}>::{closure#0}>::{closure#0}, core::result::Result<(), opentelemetry_sdk::error::OTelSdkError>>
  11: futures_executor::local_pool::block_on::<<opentelemetry_otlp::span::SpanExporter as opentelemetry_sdk::trace::export::SpanExporter>::export::{closure#0}>
  12: <opentelemetry_sdk::trace::span_processor::BatchSpanProcessor>::export_batch_sync::<opentelemetry_otlp::

Tip

React with 👍 to help prioritize this issue. Please use comments to provide useful context, avoiding +1 or me too, to help us triage it. Learn more here.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workingtriage:todoNeeds to be traiged.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions