Repository navigation
Backport #108493 to 25.8: Fix crash on deeply nested expressions with raised max_parser_depth - #108896
Conversation
… raised max_parser_depth
ee6fbb8 to
0a636f9
Compare
|
Workflow [BackportPR], commit [680c1a3] |
`ParserCollectionOfLiterals::parseImpl` builds an array/tuple/map literal
iteratively with an explicit stack of layers. When a nested collection was
finished it was appended to its parent layer with
`layers.back().arr.push_back(literal->value)`, which deep-copies the whole
nested `Field` accumulated so far. For a deeply nested literal such as
`[[[ ... ]]]` this made parsing quadratic in the nesting depth.
`literal` is a local `ASTLiteral` that is discarded immediately after this
line (only the outermost layer is kept as `node`), so its value can be moved
into the parent instead of copied. This makes the parse linear.
This is needed for the backported test `04412_deep_nested_literal_format`.
It is tagged `no-fasttest, no-debug, no-sanitizers`, but the stress test job
deliberately ignores `no-{build}` tags (every test must run under stress), so
`04412` runs under `Stress test (amd_tsan)`. With the quadratic parse, building
the depth-20000 literal in `formatQuery` took ~1620s under ThreadSanitizer and,
being non-cancellable, tripped the hung-check ("Hung check failed, possible
deadlock found"). The same quadratic parse also made `04412` run for ~441s under
`Stateless tests (amd_asan, distributed plan, parallel)` and the server got
killed by signal. With the linear parse the literal is built quickly and
`formatQuery` still reports `TOO_DEEP_RECURSION` (code 306) from the
`FieldVisitorToString` stack guard, exactly as the test expects.
This mirrors the fix already applied to the 26.6 backport in
#108832 and the master change
#108892.
CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108896&sha=0a636f95b8f50b19259d8d0280d26e62639e47a4&name_0=BackportPR&name_1=Stress%20test%20%28amd_tsan%29
Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
|
Pushed Failures addressed by this commit
This mirrors the fix already applied to the 26.6 backport in #108832 (which then went green on Unrelated failure
This is a master-wide flake: over the last 14 days each test failed 13 times across 9 distinct PRs, 5 of them on @groeneai, please investigate the flaky |
|
On the current head Four tests failed, all in the same parallel worker (
This is unrelated to the change: this PR only adds @groeneai, please investigate the flaky |
|
@alexey-milovidov thanks, investigated both. Fix PR: #108933 (off master, test-only). Both are CI-only flakes (0 master failures in 30 days; hits on unrelated PRs #107442, #107566, #107652, and here). No tracking issue existed. Root causes:
These are pre-existing flakes unrelated to the backport, so the fix is on master only, not this branch. |
Original pull-request #108493
Cherry-pick pull-request #108828
This pull-request is a last step of an automated backporting.
Treat it as a standard pull-request: look at the checks and resolve conflicts.
Merge it only if you intend to backport changes to the target branch, otherwise just close it.
The PR source
The PR is created in the CI job
Version info
25.8.26.7