Skip to content

GH-55648: [C++][CI] Fix protobuf-induced Valgrind failures - #55649

Open
pitrou wants to merge 1 commit into
apache:mainfrom
pitrou:gh55648-valgrind-protobuf
Open

pitrou wants to merge 1 commit into
apache:mainfrom
pitrou:gh55648-valgrind-protobuf

Conversation

@pitrou

@pitrou pitrou commented Nov 17, 2026 •

Copy link
Copy Markdown
Member

Rationale for this change

Silence Valgrind failures due to eternal memory allocation in Protobuf initialization routines.
Also fix Valgrind failures due to processing uninitialized padding when chunking JSON input.

Are these changes tested?

Yes, by existing CI job.

Are there any user-facing changes?

No.

Was AI used for this PR?

In accordance to the AI generation guidelines, please disclose below whether and how AI was used in this PR.

PR code and description written by:

  • Human
  • AI

Reviewed before submission by:

  • Human
  • AI
  • Not reviewed

@pitrou
pitrou force-pushed the gh55648-valgrind-protobuf branch from c47e809 to 568dbb2 Compare November 17, 2026 11:02
@pitrou

pitrou commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

@github-actions crossbow submit -g cpp

@pitrou

pitrou commented Nov 17, 2026

Copy link
Copy Markdown
Member Author

@taepper Would you like to take a quick look at this?

@github-actions

Copy link
Copy Markdown

Revision: 568dbb2

Submitted crossbow builds: ursacomputing/crossbow @ actions-6e04c8309f

Task Status
example-cpp-minimal-build-static GitHub Actions
example-cpp-minimal-build-static-system-dependency GitHub Actions
example-cpp-tutorial GitHub Actions
test-build-cpp-fuzz GitHub Actions
test-conda-cpp GitHub Actions
test-conda-cpp-valgrind GitHub Actions
test-debian-13-cpp-amd64 GitHub Actions
test-debian-13-cpp-i386 GitHub Actions
test-debian-experimental-cpp-gcc-15 GitHub Actions
test-fedora-42-cpp GitHub Actions
test-ubuntu-22.04-cpp GitHub Actions
test-ubuntu-22.04-cpp-bundled GitHub Actions
test-ubuntu-22.04-cpp-emscripten GitHub Actions
test-ubuntu-22.04-cpp-no-threading GitHub Actions
test-ubuntu-24.04-cpp GitHub Actions
test-ubuntu-24.04-cpp-gcc-13-bundled GitHub Actions
test-ubuntu-24.04-cpp-gcc-14 GitHub Actions
test-ubuntu-24.04-cpp-minimal-with-formats GitHub Actions
test-ubuntu-24.04-cpp-thread-sanitizer GitHub Actions

@taepper taepper left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Zeroing the padding of the buffer makes sense for avoiding these exact types of valgrind errors.

I cannot judge the change of

    fun:*google*protobuf*AddDescriptorsRunner*

to

    fun:*google*protobuf*AddDescriptors*

We may need to initialize these bytes as well in parser.cc:810:

    if (json->capacity() - json->size() >=
        static_cast<int64_t>(simdjson::SIMDJSON_PADDING)) {
      const auto padded_json = simdjson::padded_string_view(
          reinterpret_cast<const char*>(json->data()), json->size(), json->capacity());
      return parse(padded_json);
    }

An arrow::Buffer exposes the method ZeroPadding() which we might use here? But you are definitely more familiar with the factories for these buffers, and maybe all sources already zero it?

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants