Skip to content

Do not exhaust the stack when reading a deeply nested Dynamic or JSON value - #121441

Merged
PedroTadim merged 4 commits into
ClickHouse:masterfrom
groeneai:guard-nested-dynamic-json-value-read
Oct 5, 2026
Merged

PedroTadim merged 4 commits into
ClickHouse:masterfrom
groeneai:guard-nested-dynamic-json-value-read

Conversation

@groeneai

@groeneai groeneai commented Sep 21, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #120885

Changelog category (leave one):

  • Bug Fix (user-visible misbehavior in an official stable release)

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

Fixed a crash (stack exhaustion) when reading a Dynamic or JSON value as a Field or printing it in a text format, where the Object/Dynamic/Variant nesting is deep enough to exhaust the thread stack. Both paths now raise TOO_DEEP_RECURSION instead of terminating the server.

Description

On 26.8.10.6-lts (official build), at default settings, a value built by CAST(unhex(concat('01', repeat('3000800820000000010161', 4000), '300080082000000000')), 'AggregateFunction(any, Dynamic)') terminates the server with Segmentation fault twice over: read as a Field under EXPLAIN QUERY TREE SELECT finalizeAggregation(...), which the AST fuzzer reported as STID 4709-36d5 (job), and printed under toString(finalizeAggregation(materialize(...))), found while answering the AI review.

A Dynamic can hold a JSON object, a JSON object's dynamic path is a Dynamic, and JSON is a legal Variant member, so the value nests Object -> Dynamic -> Variant -> Object to a depth taken from the data rather than from the declared type. Each level passes through Dynamic twice, so I check the stack at both: ColumnDynamic::get, whose only existing check is in convertFieldToType, after the descent returns, and the shared serializeTextImpl of SerializationDynamic, covering all eight text formats. ColumnObject and ColumnVariant stay unguarded: the only Object -> Object route is a typed path capped at 150/300 levels by data_type_max_parse_depth, the reason #115702 dropped those guards one layer down. #120885 guards the constant-to-AST-literal walk; neither PR covers the other, and projection naming of a deep constant dies in that walk too.

One query per crash, with a shallow control each. Reverting either guard makes its query fail with the server dying; 855 json/dynamic/variant/object tests keep identical failure sets against an unpatched binary and raise TOO_DEEP_RECURSION nowhere. Depth 4000 overflows an -O2 build too; past about 8000 a type-side guard fires first.

@Avogar: the siblings (updateHashWithValue, compareAt, computeHashInto, insert*) recurse the same way, but arrayDistinct and ORDER BY over the deepest value this CAST can build, 5000 levels, both complete unguarded. I left them rather than pay a check per value per level; say the word and they go in.


Workflow [PR]
Sync PR [sync-upstream/pr/121441]

Version info

  • Merged into: 26.10.1.1547-master (included in 26.10 and later)

… value

A Dynamic value can hold a JSON object, a JSON object's dynamic path is a
Dynamic, and JSON/Object is a legal Variant member (checkAllowedInsideVariant
forbids only Nullable, LowCardinality(Nullable), a nested Variant and a direct
Dynamic). So one value can nest Object -> Dynamic -> Variant -> Object to any
depth, and that depth comes from the data: the declared type here is just
Dynamic, and each level's small type is decoded separately, so no type
complexity or parser limit bounds it.

Reading one row of such a value recurses once per level through five frames:

  ColumnObject::operator[]      (ColumnObject.cpp:305)
    -> ColumnDynamic::operator[] (ColumnDynamic.cpp:318)
    -> ColumnDynamic::get        (ColumnDynamic.cpp:328)
    -> ColumnVariant::get        (ColumnVariant.cpp:428)
    -> ColumnObject::get         (ColumnObject.cpp:327)
    -> ColumnObject::operator[]  ... repeats

at about 2.8 KB of stack per level. The one checkStackSize() that path already
reaches sits inside convertFieldToType, called at ColumnDynamic.cpp:330 after
variant_col.get(n, res) has returned, so it runs only once the descent has
completed and cannot stop the descent that overflows. Measured on a debug build
with an 8 MB stack: 1500 and 2000 levels report TOO_DEEP_RECURSION from that
call, while 3000 and 4000 levels take SIGSEGV on the way down. An -O2 build
behaves the same (these frames are dominated by Field, String and Object
temporaries rather than spills, so optimisation does not shrink them), and the
official 26.8.10.6-lts build dies the same way at default settings.

Checking the stack at the top of ColumnDynamic::get moves the check onto the way
down, once per level. Every data-driven level of this nesting passes through a
ColumnDynamic per-value method, because a JSON object's dynamic paths are
ColumnDynamic columns and its shared-data values are decoded by
SerializationDynamic, which is already guarded.

ColumnObject and ColumnVariant are deliberately left unguarded. Their nested
types come from the declared type, and DataTypeFactory.cpp:128-130 caps a
declared type's parse depth at 150 (debug) / 300, two orders of magnitude below
the depths that overflow; a probe confirms a deep JSON(a JSON(...)) is rejected
with "Maximum parse depth (150) exceeded" and the server survives. Adding a
guard there would also re-litigate 2fcfc07, which removed exactly that
construct one layer down in ClickHouse#115702 for its per-container-value cost.

About twenty further per-value methods on these three columns (insert*,
compareAt, computeHashInto, updateHashWithValue, serializeValueIntoArena,
compress, byteSizeAt, ...) recurse identically, with no observed overflow and no
reproducer; the reproducers for updateHashWithValue and getValueNameImpl are
pre-empted on this base by the analyzer recursion that ClickHouse#120885 guards, so they
are not covered here.

Alternatives rejected: guarding the entry points (eight-plus sites for one arm,
and it guards the symptom); bounding the nesting depth when the value is built
(a behaviour change that rejects values accepted today, and it cannot protect a
read of data an older server already wrote); guarding the operator[] alias as
well as get (operator[] is get, so it would double-check).

The regression test uses 4000 levels, the depth CI found and a depth measured to
overflow both a debug and an -O2 build. It should not be raised much above that:
from about 8000 levels the type-side guard in IDataType::getDefaultSerialization
fires first and returns the same error code without the column recursion ever
running deep.

Found by the AST fuzzer, STID 4709-36d5:
https://github.com/ClickHouse/ClickHouse/actions/runs/35623644754/job/106452545848
@groeneai groeneai added can be tested Allows running workflows for external contributors groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding labels Sep 21, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review of this tree: one independent cold read plus one gate pass by a second model
(engine: codex; 0 findings; $17.98). No fix round was needed, so nothing in the diff changed after the
gate ran. The four notes below are mine, all nits, none blocking; the two marked fixed changed only the
text of this PR, never the code.

# Sev Finding Verdict Evidence / action
1 💡 The regression depth 4000 is only correct inside a window the test file does not state: checkStackSize() throws at half the stack, but from about 8000 levels the type-side guard in IDataType::getDefaultSerialization wins and the test would pass without the column recursion ever running deep AGREE Noted, not fixed here. The window is measured on a debug and an -O2 build and written into the commit message; if the depth ever needs more margin the replacement is a larger value strictly below about 8000, never 10000
2 💡 The description cited ColumnDynamic.cpp:330 for the convertFieldToType call, which is the line before this diff (334 after it) AGREE, fixed Line reference dropped from the description and from the validation-gate comment; the sentence now says "called after the descent returns", which is the part that matters and does not rot
3 💡 "776 json/dynamic/variant tests pass" gave a count with no denominator, when the stronger fact was available AGREE, fixed Description now states the A/B control instead: the sweep's failures are identical on a patched and an unpatched binary (824 selected, the same 22 pre-existing failures both ways, empty symmetric difference)
4 💡 checkStackSize() is inert on a stackful coroutine or fiber stack, so a read reached from one is still unguarded DISAGREE Property of the shared helper, not of this diff: it holds at every call site, DataTypeFactory.cpp:122 documents it for the data type parser, and there is no reproducer reaching ColumnDynamic::get from a fiber. A fiber-aware variant here would be a speculative change

What I verified independently, because a per-value guard invites both questions:

  • The guard cannot make a shallow read start failing. On the non-shared branch master already
    reaches checkStackSize() a few frames deeper, inside convertFieldToType; on the shared-variant
    branch it reaches the one in IDataType::getDefaultSerialization. Both pre-existing sites sit below
    the new one, so any stack state that trips the new check already tripped one of them. The only newly
    reachable throw is the Null() early return.
  • Nothing escapes the cover. Every route out of the Object -> Dynamic -> Variant -> Object
    cycle that skips the new check is bounded: a typed path by the constexpr 150/300 parse-depth cap in
    DataTypeFactory.cpp, shared data by the existing SerializationDynamic::deserializeBinary guard,
    a shared-variant blob's type by the guard in decodeDataType, and a Variant member by its own
    declared type.
  • The test is live, not vacuous. The deep query is the assertion (with the guard reverted the runner
    reports the server dying, not a different error code), and the two-level control's expected string
    comes from Field::dump(), which no randomized setting rewrites.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are terminal
per finding.

Session id: cron:clickhouse-review-slot-8:20260921-210900

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. One query, default settings, no table: EXPLAIN QUERY TREE SELECT finalizeAggregation(CAST(unhex(concat('01', repeat('3000800820000000010161', 4000), '300080082000000000')), 'AggregateFunction(any, Dynamic)')). 1/1 on a debug build, on master's -O2 CI binary, and on the official 26.8.10.6-lts build.
b Root cause explained? Yes. The Object -> Dynamic -> Variant -> Object value-read cycle recurses once per level of data-driven nesting at about 2.8 KB of stack per level. The only checkStackSize() it reaches is inside convertFieldToType, called after variant_col.get() returns, so it runs only once the descent has completed and cannot stop the descent that overflows.
c Fix matches root cause? Yes. One checkStackSize() at the top of ColumnDynamic::get, so the check happens on the way down, once per level. Not a widened bound, not a no-random-* tag, and not a guard at the faulting line (getSharedVariantDiscriminator), which is only where the guard page happened to be touched.
d Test intent preserved / new tests added? New 05235_dynamic_json_deep_value_read_stack_guard: the deep-value assertion plus an in-range two-level control that still prints its value. No existing test altered or weakened.
e Both directions demonstrated? Yes. Without the guard: Received signal 11 / Segmentation fault, server dies, runner reports [ FAIL ] Reason: server died 32. With it: Code: 306 ... (TOO_DEEP_RECURSION), server alive, [ OK ]. The fixed build's exception is raised from the added line itself (ColumnDynamic.cpp:326 is frame 7 of the exception trace), not from some other guard returning the same code.
f Fix is general across code paths? Every data-driven level of this nesting passes through a ColumnDynamic per-value method: a JSON object's dynamic paths are ColumnDynamic columns, and its shared-data values go through the already-guarded SerializationDynamic::deserializeBinary. ColumnObject and ColumnVariant are deliberately not guarded because their nested types come from the declared type, which DataTypeFactory.cpp:128-130 caps at 150/300 levels; measured by probe, a deep declared JSON(a JSON(...)) is rejected with Maximum parse depth (150) exceeded and the server survives.
g Fix generalizes across inputs (params/datatypes/wrappers)? operator[] is covered because it is get(n, res). Array(JSON) and Array(Dynamic) re-enter ColumnDynamic one frame later; Nullable, LowCardinality(Nullable), a nested Variant and a direct Dynamic cannot appear inside a Variant at all. Depth swept 500 to 20000 on two build flavours, plus the two-level control.
h Backward compatible? (maintainer-approved exception only) Yes, and nothing to record: no setting, no default, no serialization change, so no SettingsChangesHistory.cpp entry. A query that used to terminate the server now raises TOO_DEEP_RECURSION; a query that used to work is untouched.
i Invariants and contracts preserved? checkStackSize() either returns or throws and is the first statement, so it runs before any state is read and get's postcondition is simply not entered on the throwing path. get stays const, takes no lock and allocates nothing before the check, and Field copy/destroy has been iterative since #110393, so unwinding out of a partially built deep Field does not itself recurse. No durability or restart path is involved.

Session id: cron:clickhouse-impl-slot-4:20260921-200600

@clickhouse-gh

clickhouse-gh Bot commented Sep 21, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2831c86]

Summary: ❌

job_name test_name status info comment
AST fuzzer (amd_debug, targeted, old_compatibility) FAIL
Segmentation fault (STID: 0250-04e2) FAIL cidb

AI Review

Summary

This PR correctly adds checkStackSize() on the Field-materialization path in ColumnDynamic::get and on the shared text-serialization funnel in SerializationDynamic, and the new stateless test covers both surfaces. I still cannot approve it because the same data-driven Object -> Dynamic -> Variant -> Object recursion is still unguarded on binary output, so a deep value that now returns TOO_DEEP_RECURSION under toString can still terminate the server under FORMAT RowBinary and other per-value binary serializers.

Findings
  • ❌ Blockers
    • [dismissed by author -- https://github.com/ClickHouse/ClickHouse/pull/121441#discussion_r4174609210] [src/DataTypes/Serializations/SerializationDynamic.cpp:755] serializeTextImpl is now guarded, but SerializationDynamic::serializeBinary(const ColumnDynamic &, ...) still hands nested Object values to SerializationObject::serializeBinary, which immediately re-enters dynamic_serialization->serializeBinary(...) for every dynamic path at src/DataTypes/Serializations/SerializationObject.cpp:1220. There is no checkStackSize() anywhere on that write-side cycle, so the same deep Dynamic / JSON value can still exhaust the stack on binary output instead of raising TOO_DEEP_RECURSION. Deferring this to another PR leaves the same user-visible server-termination class on a neighboring output path.
    • Suggested fix: add the guard on the binary write funnel as well — at least SerializationDynamic::serializeBinary(const Field &, ...) and SerializationDynamic::serializeBinary(const ColumnDynamic &, ...), or in a shared helper used by both binary overloads — and add a focused stateless regression that selects the same deep value as FORMAT RowBinary (or another binary format that goes through serializeBinary) and asserts TOO_DEEP_RECURSION.
Final Verdict
  • Status: ⚠️ Request changes
  • Minimum required actions: harden the binary write path for deeply nested Dynamic / JSON values and add a regression proving it raises TOO_DEEP_RECURSION instead of terminating the server.

LLVM Coverage Report

Measured on commit 2831c86.

Metric Baseline Current Δ
Lines 88.20% 88.20% +0.00%
Functions 91.80% 92.10% +0.30%
Branches 79.60% 79.60% +0.00%

Changed lines: Changed C/C++ lines covered: 7/7 (100.00%) · Uncovered code

Full report · Diff report

@clickhouse-gh clickhouse-gh Bot added the pr-bugfix Pull request with bugfix, not backported by default label Sep 21, 2026
@groeneai
groeneai requested review from Avogar and azat September 21, 2026 21:43
Comment thread src/Columns/ColumnDynamic.cpp Resolved
…N value

Every text format of Dynamic funnels through one static serializeTextImpl helper, and its
nested_serialize callback re-enters SerializationJSON for a JSON variant, which walks back
into SerializationDynamic for that object's next dynamic path. The depth of that nesting
comes from the data, so nothing bounded the descent: on the official 26.8.10.6-lts build,
at default settings,

  SELECT toString(finalizeAggregation(CAST(unhex(materialize(concat('01',
      repeat('3000800820000000010161', 4000), '300080082000000000')))
      AS AggregateFunction(any, Dynamic))))

terminates the server with a segmentation fault cycling between
SerializationDynamic::serializeTextJSON and SerializationJSON::serializeTextImpl. The
checkStackSize() this PR adds to ColumnDynamic::get does not cover it, because the value is
printed through its serialization rather than read as a Field.

One checkStackSize() at the top of the shared helper therefore covers all eight text formats
of the type (Text, JSON, JSONPretty, CSV, Escaped, Quoted, Raw, XML), which is the same
choke-point argument as for ColumnDynamic::get and mirrors the two guards this file already
carries on the binary paths.

Measured: 855 json/dynamic/variant/object tests with fixed settings, identical failure sets
before and after (36, all local object-storage and format environment failures), zero
TOO_DEEP_RECURSION anywhere in the sweep, and 30/30 runs of the new test green. Reverting
only this guard makes the added query fail with the server dying.

The sibling per-value entrypoints an AI review named (updateHashWithValue reached by
arrayDistinct, compareAt reached by ORDER BY and sorted DISTINCT) do not reach a
segmentation fault with this value shape: the CAST that builds the value itself trips
checkStackSize at about depth 6000, having consumed 4 MB of an 8 MB stack, while
arrayDistinct over the deepest value it can build, depth 5000, completes on an unguarded
binary.
void ColumnDynamic::get(size_t n, Field & res) const
{
/// Object, Dynamic and Variant values nest into each other to a depth that comes from the data, not from the declared type.
checkStackSize();

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.

This hardens Field materialization, but the same deep Object -> Dynamic -> Variant -> Object walk is still unguarded in constant/projection name generation. PlannerActionsVisitor builds names from ConstantNode::getValueName (src/Planner/PlannerActionsVisitor.cpp:437), which goes through IColumn::getValueName and then ColumnDynamic::getValueNameImpl (src/Columns/ColumnDynamic.cpp:346-375) with no checkStackSize(). That is not just a pathological setting: optimize_const_name_size < 0 explicitly disables the hash fallback in IColumn::getValueName, and TCPHandler still forces optimize_const_name_size = -1 for pre-25.10 WithMergeableState queries (src/Server/TCPHandler.cpp:2811-2815).

So the PR’s contract “deep Dynamic/JSON reads or prints now raise TOO_DEEP_RECURSION instead of terminating the server” is still false for EXPLAIN actions = 1 / projection-name surfaces that stringify the same constant value. This needs the same stack guard on the getValueNameImpl path (or an earlier bounded fallback in IColumn::getValueName) plus a regression with optimize_const_name_size = -1.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I measured the named path before answering. The mechanism does not hold, but you are right that these surfaces still terminate the server, at a site this PR deliberately leaves to #120885.

On this branch's head (debug build, 8 MiB stacks), with the deep value kept constant and numbers(2) as the source:

query optimize_const_name_size depth result
SELECT number, <deep const> FROM numbers(2) -1 1000 TOO_DEEP_RECURSION, 7739280 of 8388608 bytes
same -1 2000 / 3000 / 4000 SIGSEGV
EXPLAIN actions = 1 SELECT number, <deep const> FROM numbers(2) -1 4000 SIGSEGV
same query through remote() back to this server -1 4000 SIGSEGV
SELECT number, <deep const> FROM numbers(2) 256 (default) 4000 SIGSEGV

<deep const> is this PR's value, finalizeAggregation(CAST(unhex(concat('01', repeat('3000800820000000010161', depth), '300080082000000000')), 'AggregateFunction(any, Dynamic)')), without materialize.

Every one of those stacks is getFieldFromColumnForASTLiteralImpl cycling on itself (src/Analyzer/Utils.cpp:1538 -> :1546 -> :1569), and the depth-1000 throw comes from the IDataType::getDefaultSerialization check reached from that same walk. ColumnDynamic::getValueNameImpl is in none of them. The TCPHandler carrier is real, which is why I ran the -1 arms and not only the default ones.

I then applied the two src/Analyzer/Utils.cpp hunks of #120885 on top of this branch and rebuilt. With that walk guarded, depths 2000, 4000 and 5000 with optimize_const_name_size = -1, plus EXPLAIN actions = 1, all raise TOO_DEEP_RECURSION from the new check at Utils.cpp:1421, at 4195456 of 8388608 bytes. At 6000 the CAST that builds the value raises TOO_DEEP_RECURSION first, so 5000 levels is the deepest such value that exists.

So a check in getValueNameImpl changes no outcome on any of those queries, and the regression you ask for cannot assert TOO_DEEP_RECURSION on master today: with optimize_const_name_size = -1 and a deep constant the server dies in the analyzer walk, whose fix carries that same 4000-level constant as its own test. I am not adding the check here.

The wording was fair, though: the changelog entry claimed reads and prints in general, so I narrowed it to the two funnels this PR enforces.

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 195df7f

Every failure below has an owner: a fixing PR (mine 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
AST fuzzer (amd_debug, targeted) / Segmentation fault (STID: 0250-04e2) stack exhaustion in the analyzer constant-to-AST-literal walk, getFieldFromColumnForASTLiteralImpl (src/Analyzer/Utils.cpp:1538/1546/1569). That site is untouched by this diff and unguarded on master; the fuzzer reached it from the deeply nested value this PR's new test creates #120885 (external, open)
AST fuzzer (amd_debug, targeted, old_compatibility) / Segmentation fault (STID: 0250-04e2) same crash site, same walk #120885 (external, open)

PR is the praktika aggregator reflecting the two rows above, not a separate failure.

Session id: cron:our-pr-ci-monitor:20260922-053136

@clickhouse-gh clickhouse-gh Bot added the comp-json-datatype JSON/Dynamic/Object datatype: semi-structured column storage, typed and dynamic paths, sub-object... label Sep 22, 2026
@PedroTadim PedroTadim self-assigned this Oct 3, 2026
SerializeNull serialize_null)
{
/// See the comment in deserializeBinary: the same data-driven nesting is walked here, one level per nested value.
checkStackSize();

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.

serializeTextImpl is now guarded, but the same data-driven Object -> Dynamic -> Variant -> Object recursion is still unbounded on the binary write path. BinaryRowOutputFormat::writeField calls serialization.serializeBinary(...), SerializationDynamic::serializeBinary then recurses into the active variant, and SerializationObject::serializeBinary immediately re-enters dynamic_serialization->serializeBinary(...) for nested dynamic paths.

That means a sufficiently deep value can still exhaust the stack in FORMAT RowBinary (and any other caller of the per-value binary serializer) instead of raising TOO_DEEP_RECURSION. Can we add the same checkStackSize() on the binary write path — at least the Field and ColumnDynamic overloads of SerializationDynamic::serializeBinary, or via a shared helper used by both text and binary writers — and pin it with a focused RowBinary regression?

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Leave this for another PR

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

I measured the binary path on master before splitting it out, and could not make it fail. With this PR's test value at 5000 levels in a debug build and 6500 on the official 26.9 build (close to the deepest that can be built; deeper values throw TOO_DEEP_RECURSION while being built), FORMAT RowBinary, RowBinaryWithNamesAndTypes, formatRow('RowBinary', ...) and the AggregateFunction(any, Dynamic) state all write the full value, while toString of the same value segfaults without this PR. I found no route to a deeper value: Native input throws TOO_DEEP_RECURSION at 5000 levels, JSON text input stops at about 1000 nesting levels, and CAST from Map or Tuple flattens the nesting. So I am not opening a separate PR for the binary path unless a reproducer turns up.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

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

A reproducer turned up: the AST fuzzer sent this state through remote(), where the binary write runs on the 320 KiB remote-query coroutine stack and checkStackSize() did not check coroutine stacks. The fix is #127880.

@clickhouse-gh

clickhouse-gh Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 2831c865d with master 77abae0a5 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of bfdcb6d6c; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Compile time of recompiled translation units

8 translation units recompiled, 15 s compile time in total, 8 of them have a recent master baseline.

Job report

@groeneai

groeneai commented Oct 3, 2026

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - db8255f

Every failure below has an owner: a fixing PR (mine 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
AST fuzzer (amd_debug, targeted) / Segmentation fault (STID: 0250-04e2) not from this PR: stack exhaustion in the analyzer's constant-to-literal walk getFieldFromColumnForASTLiteralImpl (src/Analyzer/Utils.cpp, not touched here), same STID as on the previous head #120885 (external, open)
AST fuzzer (amd_debug, targeted, old_compatibility) / Segmentation fault (STID: 0250-04e2) same site #120885 (external, open)
Build (amd_fuzzers) / Build ClickHouse not from this PR: the clickhouse_fuzzer link fails on every master commit of the last 12 hours and on 150 PRs in 24h #123738 (external, open)
Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) / 04819_dynamic_aggregate_function_state_version not from this PR: the fetch with output_format_native_encode_types_in_binary_format = 1 fails under parallel replicas; 35 PRs in 24h in this job #123649 (mine, open)
Stateless tests (arm_binary, ParallelReplicas, s3 storage, parallel) / 05213_timeseries_metric_families_target not from this PR: a TimeSeries table function run on a parallel replica looks up its unqualified table argument in default; 67 PRs in 24h #123763 (mine, open)
Stateless tests (arm_binary, s3 storage, DBReplicated, parallel, 1/2) / 05237_with_expression_alias_scope_descendant not from this PR: under a Replicated database the view reads the same-named table instead of the alias declared inside its WITH expression; 161 PRs in 24h #123774 (mine, open)
Mergeable Check, PR rollups, red only because of the rows above #120885, #123738, #123649, #123763, #123774

All 160 checks completed; CIDB has no other FAIL or ERROR on this head.

Session id: cron:our-pr-ci-monitor:20261003-233424

@PedroTadim
PedroTadim enabled auto-merge October 4, 2026 19:56
@PedroTadim
PedroTadim added this pull request to the merge queue Oct 5, 2026
Merged via the queue into ClickHouse:master with commit 0882f3a Oct 5, 2026
147 of 149 checks passed
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Oct 5, 2026
alexey-milovidov pushed a commit to comino/ClickHouse that referenced this pull request Oct 16, 2026
… value

Hash functions (sipHash64, cityHash64, xxHash64, murmurHash3_64, ...) hash a
Dynamic or JSON value through ISerialization::serializeForHashCalculation.
For JSON, SerializationObject::serializeForHashCalculation calls
SerializationDynamic::serializeForHashCalculation for every dynamic, shared or
Dynamic-typed path, and a nested JSON variant calls back into Object. The type
of every nested value is decoded from the data, so the recursion depth is
bounded only by the value, and nothing on this cycle checked the stack.

A value deep enough to hash past the end of the stack can still be built,
because building it costs less stack per level than hashing it and is already
guarded (SerializationDynamic::deserializeBinary). Measured on the official
26.8.21.12 build: sipHash64 over the value from ClickHouse#123940 nested 3500 to 6000
levels deep kills the server with SIGSEGV, while the CAST that builds it
succeeds up to 6000 levels.

Check the stack at the top of SerializationDynamic::serializeForHashCalculation.
Every data-driven re-entry on the hash path passes through it (from JSON paths
and from containers of Dynamic), the same choke point ClickHouse#121441 guarded for text
serialization. Ordinary values hash byte-identically; a too-deep value now
raises TOO_DEEP_RECURSION.

Closes ClickHouse#123940

Co-Authored-By: Claude Opus 5.5 <[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 comp-json-datatype JSON/Dynamic/Object datatype: semi-structured column storage, typed and dynamic paths, sub-object... groeneai-origin-ci-master PR origin: master/nightly CI monitoring finding pr-bugfix Pull request with bugfix, not backported by default pr-synced-to-cloud The PR is synced to the cloud repo

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants