-
Notifications
You must be signed in to change notification settings - Fork 3.7k
GH-46508: [C++] Upgrade OpenTelemetry cpp to avoid build error on recent Clang #46509
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
base: main
Are you sure you want to change the base?
GH-46508: [C++] Upgrade OpenTelemetry cpp to avoid build error on recent Clang #46509
Conversation
|
@github-actions crossbow submit -g cpp |
Revision: 39582b6 Submitted crossbow builds: ursacomputing/crossbow @ actions-0137efa559 |
string(APPEND OPENTELEMETRY_CXX_FLAGS | ||
" -Wno-error=missing-template-arg-list-after-template-kw") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we still need this with the latest OpenTelemetry C++?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No we don't, as long as we all agree with to upgrade.
Please see #46509 (comment)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah, OK. We can upgrade bundled OpenTelemetry C++ if our CI passes with it. So let's remove this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done. Also triggered a crossbow build. Let's see the result. Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Seems that recent opentelemetry introduces sanitizer failures, e.g.: https://github.com/ursacomputing/crossbow/actions/runs/15148842343/job/42590903382 https://github.com/apache/arrow/actions/runs/15148814357/job/42590835285?pr=46509
@kou Shall we keep investigating these failures or fallback to the original fix? Thanks.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For TSAN I'm not sure if this is the case. I did debug a bit today but still no clue. It's much more difficult than I expected. Plus we have new emerging ASAN errors after suppressing the leak error.
I'll keep looking but this will take quite some longer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For TSAN I'm not sure if this is the case. I did debug a bit today but still no clue. It's much more difficult than I expected.
How about asking OpenTelemetry C++ developers at https://github.com/open-telemetry/opentelemetry-cpp/discussions ?
Plus we have new emerging ASAN errors after suppressing the leak error.
https://github.com/apache/arrow/actions/runs/15152202496/job/42600231311?pr=46509#step:7:4072
==16624==ERROR: AddressSanitizer: heap-use-after-free on address 0x604000010a18 at pc 0x556f354d1d0f bp 0x7fff3cb44c80 sp 0x7fff3cb44c78
WRITE of size 4 at 0x604000010a18 thread T0
#0 0x556f354d1d0e in __exchange_and_add /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/atomicity.h:66:12
#1 0x556f354d1d0e in __exchange_and_add_dispatch /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/ext/atomicity.h:101:14
#2 0x556f354d1d0e in std::_Sp_counted_base<(__gnu_cxx::_Lock_policy)2>::_M_release() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:165:6
#3 0x556f354d197e in std::__shared_count<(__gnu_cxx::_Lock_policy)2>::~__shared_count() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:705:11
#4 0x556f35500534 in std::__shared_ptr<opentelemetry::v1::trace::NoopTracer, (__gnu_cxx::_Lock_policy)2>::~__shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr_base.h:1154:31
#5 0x556f354f84c0 in std::shared_ptr<opentelemetry::v1::trace::NoopTracer>::~shared_ptr() /usr/bin/../lib/gcc/x86_64-linux-gnu/11/../../../../include/c++/11/bits/shared_ptr.h:122:11
#6 0x7f9743791a55 in __cxa_finalize (/lib/x86_64-linux-gnu/libc.so.6+0x45a55) (BuildId: cd410b710f0f094c6832edd95931006d883af48e)
#7 0x7f974f0a9ac6 in __do_global_dtors_aux crtstuff.c
It seems that this is also related to https://github.com/open-telemetry/opentelemetry-cpp/blob/v1.20.0/sdk/src/trace/tracer.cc#L41-L42 .
I think that we can suppress this too.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think that we can suppress this too.
@kou Do you happen to know how to suppress this one? I did some search but couldn't find en effective way to do it.
How about asking OpenTelemetry C++ developers at open-telemetry/opentelemetry-cpp/discussions ?
Yeah, I'll try to look into it for some more time. If it doesn't work out, I'll ask for help from opentelemetry community.
Thanks for the suggestion.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you try the following?
Add suppressions
option for ASAN:
diff --git a/cpp/build-support/run-test.sh b/cpp/build-support/run-test.sh
index 55e3fe0980..f176586a0f 100755
--- a/cpp/build-support/run-test.sh
+++ b/cpp/build-support/run-test.sh
@@ -75,10 +75,9 @@ function setup_sanitizers() {
UBSAN_OPTIONS="$UBSAN_OPTIONS suppressions=$ROOT/build-support/ubsan-suppressions.txt"
export UBSAN_OPTIONS
- # Enable leak detection even under LLVM 3.4, where it was disabled by default.
- # This flag only takes effect when running an ASAN build.
- # ASAN_OPTIONS="$ASAN_OPTIONS detect_leaks=1"
- # export ASAN_OPTIONS
+ # Set up suppressions for AddressSanitizer
+ ASAN_OPTIONS="$ASAN_OPTIONS suppressions=$ROOT/build-support/asan-suppressions.txt"
+ export ASAN_OPTIONS
# Set up suppressions for LeakSanitizer
LSAN_OPTIONS="$LSAN_OPTIONS suppressions=$ROOT/build-support/lsan-suppressions.txt"
Add cpp/build-support/asan-suppressions.txt
:
type:opentelemetry::v1::trace::NoopTracer
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. ASAN suppressions added, let's see.
4d7f655
to
0650e71
Compare
@github-actions crossbow submit -g cpp |
Revision: ac164b5 Submitted crossbow builds: ursacomputing/crossbow @ actions-90fb7c3af6 |
f74a192
to
f1368cf
Compare
I found it nearly impossible to suppress this false-positive "heap-use-after-free" ASAN error caused by partial instrumentation. I think we have three options now:
I personally vote for 3. What's your thought @kou ? Thanks. |
Rationale for this change
A warning is introduced in Clang 19.1.0 and AppleClang 17.0.0 that won't be demoted by
-Wno-error
, causing opentelemetry-cpp build failure.What changes are included in this PR?
Upgrade opentelemetry-cpp (and opentelemetry-proto correspondingly) to the most recent version, which has addressed this issue in open-telemetry/opentelemetry-cpp#3133.
Are these changes tested?
Manually build pass.
Are there any user-facing changes?
None.