-
Notifications
You must be signed in to change notification settings - Fork 449
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Crash in shared_ptr<> when compiled with -O3 #1806
Comments
I have noticed in allocation callstack from Valgrind that shared pointer type changes from ==34199== by 0x404BE30: std::shared_ptr<opentelemetry::v1::sdk::common::internal_log::LogHandler>::shared_ptr<opentelemetry::v1::sdk::common::internal_log::LogHandler, void>(opentelemetry::v1::sdk::common::internal_log::LogHandler*) (in /usr/lib64/libopentelemetry_common.so)
==34199== by 0x404BC1F: opentelemetry::v1::nostd::shared_ptr<opentelemetry::v1::sdk::common::internal_log::LogHandler>::shared_ptr(opentelemetry::v1::sdk::common::internal_log::LogHandler*) (in /usr/lib64/libopentelemetry_common.so) |
This part of the call stack probably comes from:
|
I tried to run this with Clang Undefined Behavior Sanitizer and got this:
Looks like related to or duplicate of #1337 |
Do you compile otel-cpp with |
No. here are my options: |
Thanks, the problem is when using |
Thanks for the fix, I do not see crash anymore. Clang sanitizer also does not report anything. |
Describe your environment
opentelemetry-cpp-1.7.0 compiled from official release package, configured with
cmake -DCMAKE_POSITION_INDEPENDENT_CODE=ON -DBUILD_SHARED_LIBS=ON -DWITH_OTLP=ON -DWITH_OTLP_GRPC=OFF -DWITH_PROMETHEUS=ON -DCMAKE_INSTALL_PREFIX=/usr ..
g++ (GCC) 10.3.1 20210422 (Red Hat 10.3.1-1)
CentOS Stream release 8
Linux localhost.localdomain 4.18.0-408.el8.x86_64 #1 SMP Mon Jul 18 17:42:52 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
Steps to reproduce
Compile below code using
g++ -O3 -g -o test test.cc -lopentelemetry_common
and run it:What is the expected behavior?
No crash
What is the actual behavior?
Crash. This happen only when code is compiled with
-O3
.-O2
and lower optimization levels works fine (no crash, no issues from Valgrind).Additional context
Crash details from gdb:
Crash details from Valgrind (I had to stop it using Ctrl-C):
The text was updated successfully, but these errors were encountered: