Skip to content

GH-49435: [C++][FlightRPC] Check return value for new nodiscard declared functions on Protobuf#49436

Draft
raulcd wants to merge 5 commits intoapache:mainfrom
raulcd:GH-49435
Draft

GH-49435: [C++][FlightRPC] Check return value for new nodiscard declared functions on Protobuf#49436
raulcd wants to merge 5 commits intoapache:mainfrom
raulcd:GH-49435

Conversation

@raulcd
Copy link
Member

@raulcd raulcd commented Mar 3, 2026

Rationale for this change

What changes are included in this PR?

Are these changes tested?

Are there any user-facing changes?

This PR includes breaking changes to public APIs. (If there are any breaking changes to public APIs, please explain which changes are breaking. If not, you can remove this.)

This PR contains a "Critical Fix". (If the changes fix either (a) a security vulnerability, (b) a bug that caused incorrect or invalid data to be produced, or (c) a bug that causes a crash (even when the API contract is upheld), please provide explanation. If not, you can remove this.)

@github-actions
Copy link

github-actions bot commented Mar 3, 2026

⚠️ GitHub issue #49435 has been automatically assigned in GitHub to PR creator.

Copy link
Member Author

@raulcd raulcd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The C++ build is successful now but C GLib flight fails with:

[75/124] Generating arrow-flight-glib/ArrowFlight-24.0.gir with a custom command (wrapped by meson to set env)
FAILED: [code=1] arrow-flight-glib/ArrowFlight-24.0.gir 
env PKG_CONFIG_PATH=/Users/runner/work/arrow/arrow/build/c_glib/meson-uninstalled:/tmp/local/lib/pkgconfig PKG_CONFIG=/opt/homebrew/opt/pkgconf/bin/pkgconf 'CC=/opt/homebrew/bin/ccache cc' CFLAGS= /opt/homebrew/Cellar/gobject-introspection/1.86.0/bin/g-ir-scanner --quiet --no-libtool --namespace=ArrowFlight --nsversion=24.0 --warn-all --output arrow-flight-glib/ArrowFlight-24.0.gir --c-include=arrow-flight-glib/arrow-flight-glib.h --cflags-begin -fPIE --cflags-end --include-uninstalled=arrow-glib/Arrow-24.0.gir -I/Users/runner/work/arrow/arrow/c_glib/arrow-flight-glib -I/Users/runner/work/arrow/arrow/build/c_glib/arrow-flight-glib -I/Users/runner/work/arrow/arrow/c_glib/. -I/Users/runner/work/arrow/arrow/build/c_glib/. --filelist=/Users/runner/work/arrow/arrow/build/c_glib/arrow-flight-glib/libarrow-flight-glib.2400.dylib.p/ArrowFlight_24.0_gir_filelist --include=Arrow-24.0 --symbol-prefix=gaflight --identifier-prefix=GAFlight --pkg-export=arrow-flight-glib --cflags-begin -I/Users/runner/work/arrow/arrow/c_glib/. -I/Users/runner/work/arrow/arrow/build/c_glib/. -I/tmp/local/include -I/opt/homebrew/Cellar/glib/2.86.4/include -I/opt/homebrew/Cellar/glib/2.86.4/include/glib-2.0 -I/opt/homebrew/Cellar/glib/2.86.4/lib/glib-2.0/include -I/opt/homebrew/opt/gettext/include -I/opt/homebrew/Cellar/pcre2/10.47_1/include -I/Library/Developer/CommandLineTools/SDKs/MacOSX15.sdk/usr/include/ffi -I/opt/homebrew/Cellar/gobject-introspection/1.86.0/include/gobject-introspection-1.0 --cflags-end --add-include-path=/Users/runner/work/arrow/arrow/build/c_glib/arrow-glib --add-include-path=/opt/homebrew/Cellar/gobject-introspection/1.86.0/share/gir-1.0 -L/Users/runner/work/arrow/arrow/build/c_glib/arrow-flight-glib --library arrow-flight-glib -L/Users/runner/work/arrow/arrow/build/c_glib/arrow-glib -L/tmp/local/lib -L/opt/homebrew/Cellar/glib/2.86.4/lib -L/opt/homebrew/opt/gettext/lib -L/tmp/local/lib --extra-library=arrow_flight --extra-library=arrow --extra-library=arrow_acero --extra-library=arrow_compute -L/opt/homebrew/Cellar/glib/2.86.4/lib --extra-library=gobject-2.0 --extra-library=glib-2.0 -L/opt/homebrew/opt/gettext/lib --extra-library=intl -L/opt/homebrew/Cellar/gobject-introspection/1.86.0/lib --extra-library=girepository-1.0 --sources-top-dirs /Users/runner/work/arrow/arrow/c_glib/ --sources-top-dirs /Users/runner/work/arrow/arrow/build/c_glib/ --warn-error
ld: warning: duplicate -rpath '/tmp/local/lib' ignored
ld: warning: duplicate -rpath '/opt/homebrew/opt/gettext/lib' ignored
ld: warning: duplicate -rpath '/opt/homebrew/Cellar/glib/2.86.4/lib' ignored
ld: warning: duplicate -rpath '/opt/homebrew/Cellar/glib/2.86.4/lib' ignored
ld: warning: duplicate -rpath '/opt/homebrew/opt/gettext/lib' ignored
ld: warning: ignoring duplicate libraries: '-lglib-2.0', '-lgobject-2.0', '-lintl'
Command '['/Users/runner/work/arrow/arrow/build/c_glib/tmp-introspectqsu1d025/ArrowFlight-24.0', '--introspect-dump=/Users/runner/work/arrow/arrow/build/c_glib/tmp-introspectqsu1d025/functions.txt,/Users/runner/work/arrow/arrow/build/c_glib/tmp-introspectqsu1d025/dump.xml']' died with <Signals.SIGBUS: 10>.

@kou any idea what could be the issue?

@github-actions github-actions bot added awaiting changes Awaiting changes and removed awaiting committer review Awaiting committer review labels Mar 3, 2026
@kou
Copy link
Member

kou commented Mar 4, 2026

I could reproduce this on local. I'll look into this.

@kou
Copy link
Member

kou commented Mar 5, 2026

It seems that protobuf 33.5 and 34 are mixed.

Backtrace:

(lldb) bt
* thread #1, queue = 'com.apple.main-thread', stop reason = EXC_BAD_ACCESS (code=2, address=0x197adaa0b)
  * frame #0: 0x0000000103a6a2f8 libprotobuf.34.0.0.dylib`absl::lts_20260107::strings_internal::ResizeUninitializedTraits<std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>, void>::Resize(std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*, unsigned long) + 156
    frame #1: 0x0000000103a6a1d4 libprotobuf.34.0.0.dylib`google::protobuf::internal::EpsCopyInputStream::ReadString(char const*, int, std::__1::basic_string<char, std::__1::char_traits<char>, std::__1::allocator<char>>*) + 64
    frame #2: 0x0000000103b0bc00 libprotobuf.34.0.0.dylib`google::protobuf::internal::TcParser::FastBS1(google::protobuf::MessageLite*, char const*, google::protobuf::internal::ParseContext*, google::protobuf::internal::TcFieldData, google::protobuf::internal::TcParseTableBase const*, unsigned long long) + 108
    frame #3: 0x0000000103b97718 libprotobuf.34.0.0.dylib`bool google::protobuf::internal::MergeFromImpl<false>(std::__1::basic_string_view<char, std::__1::char_traits<char>>, google::protobuf::MessageLite*, google::protobuf::internal::TcParseTableBase const*, google::protobuf::MessageLite::ParseFlags) + 92
    frame #4: 0x0000000104aab47c libprotobuf.33.5.0.dylib`google::protobuf::MessageLite::ParseFromArray(void const*, int) + 28
    frame #5: 0x00000001049dd740 libprotobuf.33.5.0.dylib`google::protobuf::EncodedDescriptorDatabase::Add(void const*, int) + 60
    frame #6: 0x00000001049926c0 libprotobuf.33.5.0.dylib`google::protobuf::DescriptorPool::InternalAddGeneratedFile(void const*, int) + 60
    frame #7: 0x0000000104a0e234 libprotobuf.33.5.0.dylib`google::protobuf::internal::AddDescriptors(google::protobuf::internal::DescriptorTable const*) + 116
    frame #8: 0x000000019779aefc dyld`invocation function for block in dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 444
    frame #9: 0x00000001977d789c dyld`invocation function for block in dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 324
    frame #10: 0x00000001977f75cc dyld`invocation function for block in mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const + 240
    frame #11: 0x00000001977f4358 dyld`mach_o::Header::forEachLoadCommand(void (load_command const*, bool&) block_pointer) const + 208
    frame #12: 0x00000001977f5a98 dyld`mach_o::Header::forEachSection(void (mach_o::Header::SectionInfo const&, bool&) block_pointer) const + 124
    frame #13: 0x00000001977d736c dyld`dyld3::MachOAnalyzer::forEachInitializer(Diagnostics&, dyld3::MachOAnalyzer::VMAddrConverter const&, void (unsigned int) block_pointer, void const*) const + 516
    frame #14: 0x000000019779acb4 dyld`dyld4::Loader::findAndRunAllInitializers(dyld4::RuntimeState&) const + 176
    frame #15: 0x00000001977a2670 dyld`dyld4::JustInTimeLoader::runInitializers(dyld4::RuntimeState&) const + 36
    frame #16: 0x000000019779b460 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 308
    frame #17: 0x000000019779b400 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 212
    frame #18: 0x000000019779b400 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 212
    frame #19: 0x000000019779b400 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 212
    frame #20: 0x000000019779b400 dyld`dyld4::Loader::runInitializersBottomUp(dyld4::RuntimeState&, dyld3::Array<dyld4::Loader const*>&, dyld3::Array<dyld4::Loader const*>&) const + 212
    frame #21: 0x000000019779fbf0 dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const::$_0::operator()() const + 180
    frame #22: 0x000000019779b77c dyld`dyld4::Loader::runInitializersBottomUpPlusUpwardLinks(dyld4::RuntimeState&) const + 716
    frame #23: 0x00000001977bca20 dyld`dyld4::APIs::runAllInitializersForMain() + 392
    frame #24: 0x000000019777fe00 dyld`dyld4::prepare(dyld4::APIs&, mach_o::Header const*) + 3092
    frame #25: 0x000000019777f1d8 dyld`dyld4::start(dyld4::KernelArgs*, void*, void*)::$_0::operator()() const + 236
    frame #26: 0x000000019777eb4c dyld`start + 6000

@kou
Copy link
Member

kou commented Mar 5, 2026

Copy link
Member

@kou kou left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you try using protobuf 33?

diff --git a/cpp/Brewfile b/cpp/Brewfile
index 811712516b..afd1bfe0a3 100644
--- a/cpp/Brewfile
+++ b/cpp/Brewfile
@@ -36,7 +36,7 @@ brew "ninja"
 brew "node"
 brew "openssl"
 brew "pkgconf"
-brew "protobuf"
+brew "protobuf@33"
 brew "python"
 brew "rapidjson"
 brew "re2"

Co-authored-by: Sutou Kouhei <kou@cozmixng.org>
@github-actions github-actions bot added awaiting change review Awaiting change review and removed awaiting changes Awaiting changes labels Mar 5, 2026
@raulcd
Copy link
Member Author

raulcd commented Mar 5, 2026

I am unsure why pinning protobuf@33 (which installs it correctly) seems to lead to CMake not finding it:

2026-03-05T11:54:41.8568190Z -- Could NOT find protobuf (missing: protobuf_DIR)
2026-03-05T11:54:44.7952510Z -- Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR) 
2026-03-05T11:54:44.7953470Z -- Protobuf: Building Protocol Buffers from source using FetchContent

and thus failing with building other dependencies: https://github.com/apache/arrow/actions/runs/22716367408/job/65866946432?pr=49436

@scpeters
Copy link

scpeters commented Mar 5, 2026

I am unsure why pinning protobuf@33 (which installs it correctly) seems to lead to CMake not finding it:

2026-03-05T11:54:41.8568190Z -- Could NOT find protobuf (missing: protobuf_DIR)
2026-03-05T11:54:44.7952510Z -- Could NOT find Protobuf (missing: Protobuf_LIBRARIES Protobuf_INCLUDE_DIR) 
2026-03-05T11:54:44.7953470Z -- Protobuf: Building Protocol Buffers from source using FetchContent

and thus failing with building other dependencies: https://github.com/apache/arrow/actions/runs/22716367408/job/65866946432?pr=49436

I'm not familiar with how CI works in this project, but I do know that protobuf@33 is "keg-only" in homebrew which means it is not linked into the default prefix and most tools won't find it. See gazebo-tooling/release-tools#1454 for an example of CI environment changes needed to use "keg-only" formulae from brew.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants