This is an automated email from the ASF dual-hosted git repository.
pitrou pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/arrow.git
The following commit(s) were added to refs/heads/main by this push:
new 28a0530b7fe GH-55648: [C++][CI] Fix protobuf-induced Valgrind failures
(#55649)
28a0530b7fe is described below
commit 28a0530b7fe2ef30ce0599a46d08658952bc95e8
Author: Antoine Pitrou <[email protected]>
AuthorDate: Tue Nov 17 13:22:39 2026 +0100
GH-55648: [C++][CI] Fix protobuf-induced Valgrind failures (#55649)
### 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](https://arrow.apache.org/docs/dev/developers/overview.html#ai-generated-code),
please disclose below whether and how AI was used in this PR.
**PR code and description written by:**
- [x] Human
- [ ] AI
**Reviewed before submission by:**
- [x] Human
- [ ] AI
- [ ] Not reviewed
* GitHub Issue: #55648
Authored-by: Antoine Pitrou <[email protected]>
Signed-off-by: Antoine Pitrou <[email protected]>
---
cpp/src/arrow/json/chunker.cc | 2 ++
cpp/valgrind.supp | 2 +-
2 files changed, 3 insertions(+), 1 deletion(-)
diff --git a/cpp/src/arrow/json/chunker.cc b/cpp/src/arrow/json/chunker.cc
index c1397ba876c..ccfc32b1b0e 100644
--- a/cpp/src/arrow/json/chunker.cc
+++ b/cpp/src/arrow/json/chunker.cc
@@ -101,6 +101,8 @@ class ParsingBoundaryFinder : public BoundaryFinder {
auto data = buffer_->mutable_data();
std::memcpy(data, partial.data(), partial.size());
std::memcpy(data + partial.size(), block.data(), block.size());
+ // Zero-initialize padding area, to avoid Valgrind failures.
+ std::memset(data + partial.size() + block.size(), 0,
simdjson::SIMDJSON_PADDING);
auto view = simdjson::padded_string_view(data, /*len=*/data_size,
/*capacity=*/buffer_->capacity());
DCHECK(view.has_sufficient_padding());
diff --git a/cpp/valgrind.supp b/cpp/valgrind.supp
index 6a2ad3f6b3b..6c3e5d65425 100644
--- a/cpp/valgrind.supp
+++ b/cpp/valgrind.supp
@@ -86,7 +86,7 @@
<protobuf>:leak on library initialization
Memcheck:Leak
...
- fun:*google*protobuf*AddDescriptorsRunner*
+ fun:*google*protobuf*AddDescriptors*
}
{
<protobuf>:leak on library initialization