Skip to content

SimpleLogRecordProcessor causes deadlockΒ #3490

@RohacekD

Description

@RohacekD

Describe your environment
I am using v1.20.0#0 from vcpkg . When I use OtlpGrpcLogRecordExporter connecting to the Azure collector that is not currently running I got deadlocked on every log.

Steps to reproduce

otlp::OtlpGrpcLogRecordExporterOptions logger_opts;
logger_opts.endpoint = endpoint;
auto exporter		= otlp::OtlpGrpcLogRecordExporterFactory::Create(logger_opts);
auto processor	= std::make_unique<logs_sdk::SimpleLogRecordProcessor>(std::move(exporter));
m_Provider		= std::make_shared<logs_sdk::LoggerProvider>(std::move(processor), std::move(resource));
auto	logger = m_Provider->GetLogger("firstlog", "library_name", OPENTELEMETRY_SDK_VERSION);
logger->EmitLogRecord(severity, msg, ...);

Because OtlpGrpcLogRecordExporter::Export finds out the server is UNAVAILABLE it tries to log this situation:

 grpc::Status status =
        OtlpGrpcClient::DelegateExport(log_service_stub_.get(), std::move(context),
                                       std::move(arena), std::move(*request), response);

if (!status.ok())
{
  OTEL_INTERNAL_LOG_ERROR(
      "[OTLP LOG GRPC Exporter] Export() failed: " << status.error_message());
  return sdk::common::ExportResult::kFailure;
}

This code goes through SimpleLogRecordProcessor::OnEmit again but this time the lock there is locked.

What is the actual behavior?
Deadlock on second entry to the SimpleLogRecordProcessor::OnEmit.

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions