Repository navigation
Conversation
|
Workflow [PR], commit [cda0490] Summary: ❌
AI ReviewSummaryThe PR fixes Final VerdictStatus: ✅ Approve |
037bb1b to
2a962d5
Compare
7df62b9 to
b9aa27f
Compare
68074cd to
f0d4172
Compare
f0d4172 to
cda0490
Compare
|
I had to push an empty commit to re-trigger AI workflow to read comments and update AI summary |
|
The failure in validation tests related to #107242 Not related to this fix. |
LLVM Coverage Report
Changed lines: Changed C/C++ lines covered by tests: 192/192 (100.00%) | Lost baseline coverage: none · Uncovered code |
|
@Algunenano could you take look. The failure in validation tests related to #107242 Other tests and AI pass. |
Cherry pick #106905 to 26.4: Fix crash in ProtobufRowInputFormat::syncAfterError on null reader
…terError on null reader
Cherry pick #106905 to 26.5: Fix crash in ProtobufRowInputFormat::syncAfterError on null reader
…terError on null reader
|
Hi @atsarevskiy @Avogar — while reviewing this PR I found the following:
Happy to discuss — close anything that's wrong or already addressed. |
|
@clickgapai I will look into #107644 |
|
Thanks for the heads-up, @atsarevskiy. I filed #107644 because PR #106905 fixes the null-pointer dereference in The fix is straightforward — call
|
Backport #106905 to 26.5: Fix crash in ProtobufRowInputFormat::syncAfterError on null reader
Backport #106905 to 26.4: Fix crash in ProtobufRowInputFormat::syncAfterError on null reader
Backport #106905 to 26.3: Fix crash in ProtobufRowInputFormat::syncAfterError on null reader
|
Hello @Avogar , To solve the issue we either have to backport #100849 (that is why it works in master) May be it is possible to reset cache, I don't know. |
Follow-up to ClickHouse#106905. After a parse error, destroyReaderAndSerializer nulls the serializer and the next readRow recreates it. setColumns was only called when row_num == 0, so when a valid row had already been appended to the block (row_num > 0), the freshly recreated serializer kept null column pointers and threw an exception (in the debug build, SIGSEGV in release) inside ProtobufSerializer::readRow. Call setColumns whenever the serializer was just (re)created, not only at the start of a block. Closes ClickHouse#107644
…-contained The functional test added by #107739 (`04409_protobuf_skip_bad_row_after_valid`) crashed with `SIGSEGV` on `25.8` because the prerequisite fix from #106905 is missing on this branch: its backport #107627 was closed without merging, so `25.8` still has void ProtobufRowInputFormat::syncAfterError() { reader->endMessage(true); } After a parse error, `readRow`'s catch block calls `destroyReaderAndSerializer`, which nulls `reader`. `IRowInputFormat::read` then calls `syncAfterError`, which dereferences the null `reader` -> `SIGSEGV`. The `setColumns` fix backported here is therefore necessary but not sufficient on `25.8`. Cherry-pick the `ProtobufRowInputFormat.cpp` part of #106905 (`cda04909d946c83546b4a9073ddf7032e9616669`): resync via `endMessage(true)` inside `readRow`'s catch while `reader` is still alive, make `syncAfterError` a no-op, and restrict `allowSyncAfterError` to the length-delimited case. The resulting `readRow` / `syncAfterError` / `allowSyncAfterError` logic is now byte-identical to `master`. The unit test from #106905 is not carried over: `25.8` has no `src/Processors/Formats/Impl/tests` directory, and the functional test `04409_protobuf_skip_bad_row_after_valid` already covers this path. Original pull-request: #107739 Prerequisite pull-request: #106905 Related: #107627 CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=111910&sha=latest&name_0=BackportPR&name_1=Stateless%20tests%20(amd_asan%2C%20distributed%20plan%2C%20parallel%2C%202%2F2) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
…at::syncAfterError on null reader
…6905 Backport ClickHouse#106905 to 26.4: Fix crash in ProtobufRowInputFormat::syncAfterError on null reader
Follow-up to ClickHouse#106905. After a parse error, destroyReaderAndSerializer nulls the serializer and the next readRow recreates it. setColumns was only called when row_num == 0, so when a valid row had already been appended to the block (row_num > 0), the freshly recreated serializer kept null column pointers and threw an exception (in the debug build, SIGSEGV in release) inside ProtobufSerializer::readRow. Call setColumns whenever the serializer was just (re)created, not only at the start of a block. Closes ClickHouse#107644
PROTO: ProtobufRowInputFormat with input_format_allow_errors_num/ratio: after a parse error, readRow destroyed the reader and IRowInputFormat then called syncAfterError, which dereferenced the null reader -> crash. Dependency of the ClickHouse#107739 backport (50b1854): the 26.3 branch had this fix (e6675f6, 2026-06-16) before ClickHouse#107739 (1c4cb1f, 2026-07-25), and the fork's v26.3.12.3 base predates it. Found by the CAND4 release gate: the ClickHouse#107739 test 04409_protobuf_skip_bad_row_after_valid crashed CAND4 (e7432ca) with SIGSEGV in ProtobufReader::endMessage via IRowInputFormat::read (evidence/fix_ci_20260925/release_cand4/logs/). Upstream patch unchanged (hunks at an 8-line offset because of ClickHouse#107739), with its gtest gtest_protobuf_sync_after_error.cpp; the stateless test is ClickHouse#107739's 04409. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ustom settings prefixes, reviewed dispatch sites, two open defects) The CAND4 (e7432ca) release gate reported, besides the open KD-D512-MIXED-GROUPBY-NULLABLE: - 3 skipped tests (04303, 04305, 04357: "no shard"): run_checks.sh passed --no-shard, a leftover from before the isolated server listened on 127.0.0.1-3 with the test clusters. Dropped, so clickhouse-test detects shard support from the server config as the triage runs do. - 05023 (ClickHouse#115334's test): the isolated server allowed only the custom_ settings prefix; it now allows SQL_,custom_ like the upstream test config (tests/config/config.d/custom_settings_prefixes.xml). isolated_ch.sh is vendored from the skill draft; VENDORED.sha256 updated. - 2 dispatch-scan candidates: the Int512 fast path of 7581066 (bothFitInt256/mulInt256Range); reviewed, not a gap. - 04411 (ClickHouse#108607's test): its three-index section recurses in equals() on every 26.3 build, including production and builds without the backport (FILE_DOESNT_EXIST, the bug ClickHouse#108607 fixes, is gone). New open KD-UP-TEXTINDEX-DIRECTREAD-3IDX (pre-existing upstream 26.3 bug, upstream fix not identified; workaround query_plan_direct_read_from_text_index = 0). - 04881 (ClickHouse#114624's test): its only differing line is the reference with the host name 'build' replaced by 'localhost' by clickhouse-test; the output is otherwise identical. New open KD-ENV-HOSTNAME-SUBSTITUTION (environment); the test and its reference are not edited. The fifth failure, 04409, is the missing dependency ClickHouse#106905 (previous commit). Registry: 147 entries, 3 open. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ickHouse#110754, not to 26.3) PROTO: ProtobufSchemas cached one importer per schema directory and looked a message up by name in the importer's whole descriptor pool before importing the requested file. Two schema files in the same directory that define a message with the same name (or the same file used as Protobuf and as ProtobufList with an Envelope) then shared the first descriptor: a query could parse its input with another file's message definition, i.e. wrong columns, errors or wrongly parsed data. The fix keys the importer by (directory, schema file, envelope) and looks the message up in the imported file only. Found by the CAND5 gtest run: three unit tests of the ClickHouse#106905 backport (gtest_protobuf_sync_after_error.cpp) give each test its own inline schema with a message named Row and failed with "Not found matches between the names of the columns (d) and the fields (number) of the message 'Row'" - the previous test's schema. The stateless test is the upstream 04061_protobuf_cache_with_envelope. Upstream patch unchanged (applies cleanly), with its test and schemas. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Changelog category
Critical Bug Fix
Changelog entry
Fix server crash (SIGSEGV) when reading truncated Protobuf data with
input_format_allow_errors_num > 0.Summary
ProtobufRowInputFormat::syncAfterError()dereferencesreaderwithout a null check. WhenreadRow()throws a parse error (e.g.CANNOT_READ_ALL_DATAfrom truncated fixed32 field), its function-try-block callsdestroyReaderAndSerializer()which setsreader = nullptr. The exception then propagates toIRowInputFormat::read(), which callssyncAfterError()to skip past the bad message — crashing on the null pointer.Stack trace:
Once crashed, the server sets
is_crashed = trueand refuses all subsequent connections including/ping.The fix adds a null check before calling
reader->endMessage(true).Closes #106904
Version info
26.6.1.86326.5.3.38,26.4.5.42,26.3.14.34