-
Notifications
You must be signed in to change notification settings - Fork 572
Description
What happened?
When integrating the opentelemetry crate with the tracing_subscriber
crate, calling tracing::event!
and its derivates after the SdkLoggerProvider
has been called leads to a stack overflow due to BatchLogProcessor::emit
using otel_warn!
when trying to report the mpsc::TrySendError:Disconnected
error.
It seems that under the hood, otel_warn!
may call tracing::warn!
, which will cause the warning reporting the BatchLogProcessor being shutdown to get fed back into the BatchLogProcessor
due to the tracing subscriber being none the wiser, which in turn causes the same warning to be emitted again, leading to infinite recursion.
I have created a PR that fixes this issue by simply not calling otel_warn!
in this edge case if the log record itself is emitted by the same otel_warn!
. I will publish this PR after creating this issue.
OpenTelemetry API Version (i.e version of opentelemetry
crate)
0.30.0
OpenTelemetry SDK Version (i.e version of opentelemetry_sdk
crate)
0.30.0
What Exporter(s) are you seeing the problem on?
N/A
Relevant log output
thread 'test_no_stack_overflow_when_event_is_emitted_after_shutdown' has overflowed its stack
fatal runtime error: stack overflow, aborting
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.