Skip to content

Stack overflow during shutdown of BatchLogProcessor #3023

@zheilbron

Description

@zheilbron

opentelemetry_sdk version: 0.29

If I enable debug logging for the crate I see the following:

2025-06-09T19:45:59.696986Z DEBUG opentelemetry_sdk:  name="BatchLogProcessor.ExportingDueToForceFlush"
2025-06-09T19:45:59.697019Z DEBUG opentelemetry-otlp:  name="TonicsLogsClient.CallingExport"
2025-06-09T19:45:59.697580Z DEBUG opentelemetry_sdk:  name="LoggerProvider.ShutdownInvokedByUser"
2025-06-09T19:45:59.697604Z DEBUG opentelemetry_sdk:  name="BatchLogProcessor.ExportingDueToShutdown"
2025-06-09T19:45:59.697625Z DEBUG opentelemetry-otlp:  name="TonicsLogsClient.CallingExport"
2025-06-09T19:45:59.698071Z DEBUG opentelemetry_sdk:  name="BatchLogProcessor.ThreadExiting" reason="ShutdownRequested"
2025-06-09T19:45:59.698081Z DEBUG opentelemetry_sdk:  name="BatchLogProcessor.ThreadStopped"

thread 'OpenTelemetry.Traces.BatchProcessor' has overflowed its stack
fatal runtime error: stack overflow

Note without debug logging, I see that other threads can also trigger the SO:

...
thread 'tokio-runtime-worker' has overflowed its stack
fatal runtime error: stack overflow
...

This makes me think that it has something to do with the the last caller to emit a log and/or a full channel, but that's just a guess.

The code that triggers it:

// let p: SdkLoggerProvider ...
...
p.force_flush().ok();
p.shutdown().ok();

Does not happen if i remove shutdown.

Possibly related to #2897.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions