Skip to content
Draft
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions functional/otlp/func_grpc_main.cc
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
// SPDX-License-Identifier: Apache-2.0

#include <chrono>
#include <grpc/grpc.h>
#include <cstdint>
#include <cstdio>
#include <cstring>
Expand Down Expand Up @@ -434,7 +435,16 @@ int main(int argc, char *argv[])
internal_log::GlobalLogHandler::SetLogHandler(log_handler);
internal_log::GlobalLogHandler::SetLogLevel(internal_log::LogLevel::Debug);

// Keep one explicit gRPC runtime reference for the lifetime of the functional test.
// Channel construction owns additional references internally, but their final release may
// start asynchronous global teardown just as this short-lived process is returning. The TLS
// failure cases exercise gRPC background work heavily enough that this has intermittently
// raced process exit in CI. Holding our own reference lets us destroy every OpenTelemetry/gRPC
// object first, then wait for the final gRPC teardown to complete before leaving main().
grpc_init();
rc = run_test_case(opt_test_name);
grpc_shutdown_blocking();

return rc;
}

Expand Down
Loading