Skip to content

Bump contrib/thrift to Apache Thrift v0.24.0 - #111278

Merged
thevar1able merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/bump-thrift-v0.24.0
Jul 29, 2026
Merged

thevar1able merged 2 commits into
ClickHouse:masterfrom
groeneai:groeneai/bump-thrift-v0.24.0

Conversation

@groeneai

@groeneai groeneai commented Jul 21, 2026 •

Copy link
Copy Markdown
Collaborator

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Updated the bundled Apache Thrift library to version 0.24.0.

Description

Bumps contrib/thrift from the ClickHouse/v0.23.0 lineage (248688d4) to the ClickHouse/v0.24.0 branch (13d30d6a), which is Apache Thrift v0.24.0 with the ClickHouse/-specific patch f95a731b ("Don't use locale in to_string") cherry-picked on top. The ClickHouse/v0.24.0 branch was created by @thevar1able.

v0.24.0 includes Apache commit 983c813c, which fixes a signed-integer overflow in the compact-protocol container-size prechecks: checkReadBytesAvailable(TSet/TList/TMap) now computes static_cast<int64_t>(size_) * elemSize instead of int32 * int. size_ is read from the wire (corrupt/fuzzed Parquet/ORC metadata), so a large declared cardinality previously overflowed signed int. This is the proper upstream fix (with its own regression tests) for the UBSan finding STID 3543-4a91 that closed PR #111186 tried to silence via tests/ubsan_ignorelist.txt.

This supersedes the ignorelist approach from #111186 (closed), per @pamarcos's suggestion to sync the fork to v0.24.0. Fork-side sync was done in ClickHouse/thrift#10; the release branch was ultimately created directly by @thevar1able. master's tests/ubsan_ignorelist.txt has no Thrift entry (it only existed on #111186's branch), so nothing needs to be removed here.

UBSan report that surfaced the overflow: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=110171&sha=b3699207b14e085180bef427dac73696403b023c&name_0=PR&name_1=Stress%20test%20%28arm_asan_ubsan%2C%20s3%29

Verified locally that ClickHouse still builds and links Thrift and Arrow (the Parquet/ORC consumer) against the new tree.

Version info

  • Merged into: 26.8.1.385 (included in 26.8 and later)
  • Backported to: 26.7.2.43, 26.6.2.130, 26.5.6.112, 26.3.17.104, 25.8.29.48

Point contrib/thrift at the ClickHouse/thrift ClickHouse/v0.24.0 branch
(13d30d6a): Apache Thrift v0.24.0 with the ClickHouse patch f95a731b
("Don't use locale in to_string") cherry-picked.

v0.24.0 includes Apache commit 983c813c, which widens the compact-protocol
container-size prechecks to int64 (static_cast<int64_t>(size_) * elemSize),
fixing a signed-integer overflow on wire-controlled sizes. This is the
upstream fix for UBSan finding STID 3543-4a91, superseding the ubsan_ignorelist
approach from ClickHouse#111186 (closed) as suggested by @pamarcos.

Co-Authored-By: Claude Opus 4.8 <[email protected]>
@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? The original UBSan finding (STID 3543-4a91) is a fuzzer-only signed-integer overflow on corrupt/fuzzed Parquet/ORC metadata (1 hit / 60d). It is not deterministically reproducible standalone; correctness here is established by the upstream fix + its own regression tests, not a local functional repro.
b Root cause explained? checkReadBytesAvailable(TSet/TList/TMap) computed size_ * elemSize as int32 * int; size_ is read from the wire, so a large declared cardinality overflowed signed int. Apache fixed it in 983c813c by widening to static_cast<int64_t>(size_) * elemSize.
c Fix matches root cause? Yes. The pin (13d30d6a) is Apache Thrift v0.24.0, which contains 983c813c (verified: 983c813c is an ancestor of the pinned commit; static_cast<int64_t> present in all three TCompactProtocol.h overloads). Supersedes the ubsan_ignorelist band-aid from #111186.
d Test intent preserved / new tests added? Preserved. The regression tests ship with the upstream fix (983c813c). No ClickHouse test is weakened; master's tests/ubsan_ignorelist.txt has no Thrift entry to remove.
e Both directions demonstrated? "Before" = int32 * int overflow (UBSan abort). "After" = int64_t arithmetic, present in the pinned tree (verified). No CH-side functional test to loop; verification is presence-of-fix + ClickHouse builds/links against the new tree.
f Fix is general across code paths? Yes. The upstream fix covers all TSet/TList/TMap overloads and the TBinaryProtocol/TProtocol siblings, not a single call site.
g Fix generalizes across inputs? N/A — third-party library version sync, not a ClickHouse code bug.
h Backward compatible? (maintainer-approved exception only) Yes. Thrift is an internal build dependency; no user-visible on-disk/wire/setting change. Verified _thrift + _arrow (the Parquet/ORC consumer) still compile and link; cmake source list unchanged.
i Invariants and contracts preserved? Yes. .gitmodules url unchanged (no branch= tag; convention per docs/en/development/contrib.md). Guarded submodule-hygiene diff shows only contrib/thrift, no other contrib drift. Build/link verification confirms no ABI break for the Arrow consumer.

Session id: cron:clickhouse-author-slot-2:20260721-190200

@clickhouse-gh

clickhouse-gh Bot commented Jul 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c3dd844]

Summary: ✅


AI Review

Summary

Reviewed the contrib/thrift gitlink bump from 248688d4 to 13d30d6a. For ClickHouse's actual usage surface, the material C++ change is the 64-bit checkReadBytesAvailable fix in the Thrift protocols used by Parquet/ORC, plus a few unrelated runtime hardenings; the upstream range includes focused C++ regression tests for the overflow path, and Praktika is green on this PR. I did not find a ClickHouse-specific correctness, compatibility, or integration issue that warrants an inline comment.

Final Verdict

✅ No new blocking issues found. No inline review comments posted.

@clickhouse-gh clickhouse-gh Bot added pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR. labels Jul 21, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 4de8362

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt. This PR is a 1-line contrib/thrift submodule pin bump (Apache Thrift v0.24.0) and cannot affect any of the failing code paths (parallel-replicas coordinator, analyzer type inference, replicated-DB DDL, CHECK TABLE), so none of these are PR-caused.

Check / test Reason Owner / fixing PR
Stateless (amd_llvm_coverage, ParallelReplicas, s3, parallel) / Got read request from replica for unknown stream (STID 5217-505b) server abort a fix task is tracking it (investigating at full effort; fixing-PR link to follow here)
Stateless (amd_llvm_coverage, ParallelReplicas, s3, parallel) / Server died server abort victim of STID 5217-505b (same abort)
Stateless (amd_llvm_coverage, ParallelReplicas, s3, parallel) / 02465_limit_trivial_max_rows_to_read server abort victim of STID 5217-505b (same abort)
Stateless (amd_llvm_coverage, old analyzer, s3, DBReplicated, WasmEdge, 2/3) / Arguments have incorrect data types (STID 2735-47bf) server abort #109747 (ours, open)
Stateless (amd_llvm_coverage, old analyzer, s3, DBReplicated, WasmEdge, 2/3) / Server died server abort victim of STID 2735-47bf (same multiply(Int256, Float64) abort)
Integration (amd_asan_ubsan, db disk, old analyzer) / test_replicated_table_structure_alter flaky #111029 (ours, open)
Integration (amd_asan_ubsan, db disk, old analyzer) / test_check_all_tables flaky a fix task is tracking it (investigating at full effort; fixing-PR link to follow here)

Session id: cron:our-pr-ci-monitor:20260722-023000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the test_check_all_tables flaky (Integration amd_asan_ubsan, db disk, old analyzer): #111353 (merged 2026-07-22, backported to 26.7 by #111574).

The failure is the plain-rewritable metadata_dropped concurrent-create race, not anything in this PR. Every occurrence after that merge is on a build whose base predates it: I checked all 49 distinct commits that produced this failure since 2026-07-22 17:31Z, and 49 of 49 lack the fix. Merging master into this PR picks it up. Details: #111477 (comment)

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Jul 28, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — c3dd844

Every failure below has an owner: a fixing PR (ours or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) / Server died + Got read request from replica A for unknown stream B (STID 5217-5b3d) parallel-replicas coordinator rejects a stream it did not register; the server death cascades the shard #111689 (ours, open)
Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel) / 04490_any_join_constant_condition_reorder result differs (extra duplicate row) under the ParallelReplicas coverage check #112317 (ours, open)

Session id: cron:our-pr-ci-monitor:20260729-043000

@thevar1able
thevar1able added this pull request to the merge queue Jul 29, 2026
Merged via the queue into ClickHouse:master with commit 34686a7 Jul 29, 2026
351 of 352 checks passed
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Jul 29, 2026
@chethan-64

Copy link
Copy Markdown

@thevar1able is it possible to backport this changes to 25.8? as there are bunch of CVE's need to be fixed.

clickhouse-gh Bot added a commit that referenced this pull request Jul 30, 2026
Backport #111278 to 26.7: Bump contrib/thrift to Apache Thrift v0.24.0
clickhouse-gh Bot added a commit that referenced this pull request Jul 30, 2026
Backport #111278 to 26.6: Bump contrib/thrift to Apache Thrift v0.24.0
robot-ch-test-poll4 added a commit that referenced this pull request Aug 3, 2026
Cherry pick #111278 to 25.8: Bump contrib/thrift to Apache Thrift v0.24.0
robot-ch-test-poll4 added a commit that referenced this pull request Aug 3, 2026
Cherry pick #111278 to 26.3: Bump contrib/thrift to Apache Thrift v0.24.0
robot-ch-test-poll4 added a commit that referenced this pull request Aug 3, 2026
Cherry pick #111278 to 26.5: Bump contrib/thrift to Apache Thrift v0.24.0
@robot-ch-test-poll robot-ch-test-poll added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Aug 3, 2026
thevar1able added a commit that referenced this pull request Aug 3, 2026
Backport #111278 to 26.3: Bump contrib/thrift to Apache Thrift v0.24.0
thevar1able added a commit that referenced this pull request Aug 3, 2026
Backport #111278 to 25.8: Bump contrib/thrift to Apache Thrift v0.24.0
thevar1able added a commit that referenced this pull request Aug 3, 2026
Backport #111278 to 26.5: Bump contrib/thrift to Apache Thrift v0.24.0
PedroTadim added a commit that referenced this pull request Sep 29, 2026
Resolves the one conflict in the automated cherry-pick, `contrib/thrift`.

26.3 already carries Apache Thrift v0.24.0, backported as #111278, while
#98882 was the earlier step that moved master from v0.16.0 to v0.22.0.
Taking the cherry-picked side would downgrade the submodule, so ours is
kept: 26.3 and master both stay on 13d30d6a6cdf (v0.24.0).

Everything else merged cleanly. `MergeTreeRangeReader.cpp` and
`MergeTreeReadTask.h` come out unchanged because the text-index prewhere
fix that rides along with this PR is already on 26.3, so git recognised it
as applied rather than dropping it.

Original pull-request: #98882
Cherry-pick pull-request: #122872

Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors manual approve Manual approve required to run CI pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-build Pull request with build/testing/packaging improvement pr-must-backport Pull request should be backported intentionally. Use this label with great care! pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants