Skip to content

Crash during initialization in #3363

@o-hainz

Description

@o-hainz

Describe your environment
I'm on a Windows Server 2022. I use Visual Studio 2022. For the build of the package I'm using vcpkg and there the latest version 2025.04.09 which contains the version 1.20.0 from the repository opentelemetry-cpp.
Before we worked with an older version of opentelemetry-cpp and there it worked fine.

Steps to reproduce
I create a small console application to reproduce it. Everything you need to reproduce is hopefully in this Zip-file:

OpenTelemetryCpp.zip

Here the steps you need to do:

  • Extract the OpenTelemetryCpp.zip somewhere on your Windows PC.
  • You will need a little bit of free disk space because VCPKG will need some space. I would estimate round about 50GB.
  • In the root folder you will find the file prepare_project_folder.cmd. Please execute it in the root folder or do the following steps in the root folder:
git clone https://github.com/microsoft/vcpkg.git
git checkout tags/2025.04.09
cd vcpkg
cmd /C bootstrap-vcpkg.bat
vcpkg update
vcpkg install "opentelemetry-cpp[otlp-grpc,otlp-http]:x64-windows" --recurse
cd ..
  • This will clone the vcpkg repository into the root folder and builds opentelemetry-cpp.
  • This will take a some time.
  • Now you should open the solution OpenTelemetryCpp.sln.
  • Please use the configuration Debug/x86. The other ones are not configured.
  • Build the solution.
  • Run the project it in Debug/x86 mode.

You should get an error and the stack trace should like this:

 	ucrtbased.dll!00007ffb0e2a2fb5()	Unknown
 	ucrtbased.dll!00007ffb0e2a3153()	Unknown
 	ucrtbased.dll!00007ffb0e2bae2d()	Unknown
 	ucrtbased.dll!00007ffb0e2c1345()	Unknown
 	ucrtbased.dll!00007ffb0e2c0bd7()	Unknown
 	ucrtbased.dll!00007ffb0e2bebc8()	Unknown
 	ucrtbased.dll!00007ffb0e2c18af()	Unknown
>	OpenTelemetryCpp.exe!absl::otel_v1::variant_internal::VisitIndicesSwitch<15>::Run::__l4::<lambda_1>::operator()() Line 427	C++
 	OpenTelemetryCpp.exe!absl::otel_v1::variant_internal::VisitIndicesSwitch<15>::Run<absl::otel_v1::variant_internal::VariantStateBaseDestructorNontrivial<bool,int,unsigned int,__int64,double,std::string,std::vector<bool,std::allocator<bool>>,std::vector<int,std::allocator<int>>,std::vector<unsigned int,std::allocator<unsigned int>>,std::vector<__int64,std::allocator<__int64>>,std::vector<double,std::allocator<double>>,std::vector<std::string,std::allocator<std::string>>,unsigned __int64,std::vector<unsigned __int64,std::allocator<unsigned __int64>>,std::vector<unsigned char,std::allocator<unsigned char>>>::Destroyer>(absl::otel_v1::variant_internal::VariantStateBaseDestructorNontrivial<bool,int,unsigned int,__int64,double,std::string,std::vector<bool,std::allocator<bool>>,std::vector<int,std::allocator<int>>,std::vector<unsigned int,std::allocator<unsigned int>>,std::vector<__int64,std::allocator<__int64>>,std::vector<double,std::allocator<double>>,std::vector<std::string,std::allocator<std::string>>,unsigned __int64,std::vector<unsigned __int64,std::allocator<unsigned __int64>>,std::vector<unsigned char,std::allocator<unsigned char>>>::Destroyer && op, unsigned __int64 i) Line 427	C++
 	OpenTelemetryCpp.exe!absl::otel_v1::variant_internal::VariantStateBaseDestructorNontrivial<bool,int,unsigned int,__int64,double,std::string,std::vector<bool,std::allocator<bool>>,std::vector<int,std::allocator<int>>,std::vector<unsigned int,std::allocator<unsigned int>>,std::vector<__int64,std::allocator<__int64>>,std::vector<double,std::allocator<double>>,std::vector<std::string,std::allocator<std::string>>,unsigned __int64,std::vector<unsigned __int64,std::allocator<unsigned __int64>>,std::vector<unsigned char,std::allocator<unsigned char>>>::destroy() Line 1316	C++
 	OpenTelemetryCpp.exe!absl::otel_v1::variant_internal::VariantStateBaseDestructorNontrivial<bool,int,unsigned int,__int64,double,std::string,std::vector<bool,std::allocator<bool>>,std::vector<int,std::allocator<int>>,std::vector<unsigned int,std::allocator<unsigned int>>,std::vector<__int64,std::allocator<__int64>>,std::vector<double,std::allocator<double>>,std::vector<std::string,std::allocator<std::string>>,unsigned __int64,std::vector<unsigned __int64,std::allocator<unsigned __int64>>,std::vector<unsigned char,std::allocator<unsigned char>>>::~VariantStateBaseDestructorNontrivial<bool,int,unsigned int,__int64,double,std::string,std::vector<bool,std::allocator<bool>>,std::vector<int,std::allocator<int>>,std::vector<unsigned int,std::allocator<unsigned int>>,std::vector<__int64,std::allocator<__int64>>,std::vector<double,std::allocator<double>>,std::vector<std::string,std::allocator<std::string>>,unsigned __int64,std::vector<unsigned __int64,std::allocator<unsigned __int64>>,std::vector<unsigned char,std::allocator<unsigned char>>>() Line 1318	C++
 	[External Code]	
 	OpenTelemetryCpp.exe!absl::otel_v1::variant<bool,int,unsigned int,__int64,double,std::string,std::vector<bool,std::allocator<bool>>,std::vector<int,std::allocator<int>>,std::vector<unsigned int,std::allocator<unsigned int>>,std::vector<__int64,std::allocator<__int64>>,std::vector<double,std::allocator<double>>,std::vector<std::string,std::allocator<std::string>>,unsigned __int64,std::vector<unsigned __int64,std::allocator<unsigned __int64>>,std::vector<unsigned char,std::allocator<unsigned char>>>::~variant<bool,int,unsigned int,__int64,double,std::string,std::vector<bool,std::allocator<bool>>,std::vector<int,std::allocator<int>>,std::vector<unsigned int,std::allocator<unsigned int>>,std::vector<__int64,std::allocator<__int64>>,std::vector<double,std::allocator<double>>,std::vector<std::string,std::allocator<std::string>>,unsigned __int64,std::vector<unsigned __int64,std::allocator<unsigned __int64>>,std::vector<unsigned char,std::allocator<unsigned char>>>() Line 569	C++
 	[External Code]	
 	OpenTelemetryCpp.exe!opentelemetry::v1::sdk::resource::Resource::GetDefault() Line 63	C++
 	OpenTelemetryCpp.exe!opentelemetry::v1::sdk::resource::Resource::Create(const opentelemetry::v1::sdk::common::AttributeMap & attributes, const std::string & schema_url) Line 38	C++
 	OpenTelemetryCpp.exe!InitTracer() Line 99	C++
 	OpenTelemetryCpp.exe!main() Line 140	C++
 	[External Code]	

On the output of the console is this message:

Assertion failed: false && "i == variant_npos", file D:\Dev\Git\OpenTelemetryCpp\vcpkg\installed\x64-windows\include\opentelemetry\nostd\internal\absl\types\internal\variant.h, line 427

I think the issue starts in this function:

Resource &Resource::GetDefault()
{
  static Resource default_resource(
      {{semconv::telemetry::kTelemetrySdkLanguage, "cpp"},
       {semconv::telemetry::kTelemetrySdkName, "opentelemetry"},
       {semconv::telemetry::kTelemetrySdkVersion, OPENTELEMETRY_SDK_VERSION}},
      std::string{});
  return default_resource;
}

After all the application did not start.

What is the expected behavior?
The application should start.

What is the actual behavior?
The application did not start and reports the error.

Metadata

Metadata

Assignees

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