Skip to content

More fuzzing in CI - #131994

Merged
PedroTadim merged 16 commits into
masterfrom
more-fuzz16
Nov 20, 2026
Merged

PedroTadim merged 16 commits into
masterfrom
more-fuzz16

Conversation

@PedroTadim

@PedroTadim PedroTadim commented Nov 16, 2026 •

Copy link
Copy Markdown
Member

Changelog category (leave one):

  • CI Fix or Improvement (changelog entry is not required)

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

Extended the BuzzHouse and AST fuzzers and casa_del_dolor: DEFAULT and MATERIALIZED expressions in table-function column structures and more extreme literal values, broader streaming-engine coverage (Kafka, S3Queue, NATS, RabbitMQ) with settings fixes, more JOIN kinds and WHERE/ON predicate shapes, and more dictionary, hive-partitioning, disk, data-lake and table-swap coverage, INSERT INTO FUNCTION ... PARTITION BY for the file, url and object-storage table functions (with {_partition_id} in the path), along with new settings and statements. The server-side AST fuzzer now runs after the query finishes, so the query's query_log entry and HTTP response no longer include the fuzzing, and the fuzzQuery table function takes a new seed on each read unless random_seed is set. The stress test randomizes allocation failures inside merges and mutations. The casa_del_dolor restart-hash oracle skips tables with pending mutations, with inserts that land between the two hashes, or with lossy codecs (SZ3, Quantized), which BuzzHouse also keeps off deterministic tables. Other oracle false positives are avoided, and the Trivial merge selector is not used with the private binary.


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

Version info

  • Merged into: 26.12.1.86-master (included in 26.12 and later)

@clickhouse-gh

clickhouse-gh Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [174d412]

Summary: ✅


AI Review

Summary

The PR expands BuzzHouse and AST mutation coverage, adds streaming integrations to Casa, moves server-side AST fuzzing after query completion, and improves oracle filtering. Request changes for one remaining restart-hash false positive. No new inline findings were identified; the remaining concern belongs to an existing author-resolved thread.

Findings

⚠️ Majors

  • tests/casa_del_dolor/oracles.py:46 — The write marker can miss a late insert into another partition. [dismissed by author -- https://github.com/More fuzzing in CI #131994#discussion_r4619965360] The current fix still assumes block numbers increase across the entire table, but StorageReplicatedMergeTree::allocateBlockNumber allocates them independently under each partition's Keeper path. With partition A at block 100, an asynchronous insert into partition B can flush after the first hash and receive block 1; both table-wide maxima remain 100. With unchanged mutation IDs, the second hash then reports Hash mismatch on a correct server. Partitioned replicated tables in a Replicated database pass the eligibility filter. Compare per-partition maxima, including newly appearing partitions, or quiesce outstanding writes before hashing. This affects hash-enabled Casa runs, enabled by default; the current CI invocation disables restart-hash comparisons.
Tests
  • ⚠️ Verify a hash-enabled restart with a queued asynchronous insert into a lower-numbered partition of a replicated table. The comparison must detect the write and skip the corruption assertion.
Missing context / blind spots
  • ⚠️ Verification was source-based; no local build or runtime tests were run. At reviewed head 174d4124b5fe5bd2d7578734bc219ee0c0b2ff86, the relevant fuzzing and stress jobs were pending in the Praktika report. Completed jobs would provide runtime evidence for the expanded coverage.
Final Verdict

Status: ⚠️ Request changes

Make restart-hash write detection account for partition-local block numbers and verify the queued-insert case above.

@clickhouse-gh clickhouse-gh Bot added pr-ci comp-testing Test content only (no production code). labels Nov 16, 2026
PedroTadim added a commit that referenced this pull request Nov 16, 2026
The master merge brought in the repo-wide `modernize-use-nodiscard`,
`readability-container-contains` and `clang-analyzer` tidy checks with
`WarningsAsErrors: '*'`, which the BuzzHouse changes on this branch had
not accounted for:

- Add `[[nodiscard]]` to the const value-returning methods in
  `FuzzConfig.cpp` (7) and `SQLCatalog.h` (118).
- Use `String::contains` instead of `find(...) == String::npos` in
  `SQLTable.cpp` and `StatementGenerator.cpp`.
- Add a `chassert(nsubtype)` in `ArrayType::PostgreSQLtypeName` to
  express the non-null invariant after removing the `INT[]` fallback,
  silencing `clang-analyzer-core.CallAndMessage`.

CI tidy report: https://github.com/ClickHouse/ClickHouse/actions/runs/43870935199
PR: #131994

Co-Authored-By: Claude Opus 4.8 <[email protected]>
PedroTadim added a commit that referenced this pull request Nov 16, 2026
Two violations surfaced once the tidy build stopped dropping the Style job:

- `FuzzConfig.cpp`: the `cpp` paren-spacing rule false-positived on a raw
  string literal whose SQL fragment began with `( AND`. Switch that one
  fragment to a plain string literal (no SQL change).
- `SQLProtoStr.cpp`: the abbreviation rule flagged `kModifySqlSecurity`, which
  is protobuf-generated from the `modify_sql_security` field and cannot be
  spelled with `SQL` in caps. Add it to the existing exclusion list in
  `check_cpp.sh`, alongside `SqlInfo` / `CommandGetSqlInfo`.

PR: #131994

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

clickhouse-gh Bot commented Nov 16, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 174d4124b with master c11848bfc (stripped binary size, per-symbol sizes and ThinLTO time; 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.

Object file sizes

6 object files changed (+135.63 KiB total), 0 added.

Object file Master PR Δ
src/CMakeFiles/clickhouse_common_io.dir/Common/QueryFuzzer.cpp.o 2.12 MiB 2.25 MiB +134.70 KiB (+6.21%)

716 more object files are built by the master warmup baseline only (it builds every object-file target, a pull request build only clickhouse-bundle) and not compared.

Compile time of recompiled translation units

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

Job report

Comment thread programs/client/FuzzLoop.cpp Resolved
Comment thread tests/casa_del_dolor/oracles.py Resolved
clickhouse-gh[bot]
clickhouse-gh Bot previously approved these changes Nov 17, 2026
valerypetrov pushed a commit to valerypetrov/ClickHouse that referenced this pull request Nov 17, 2026
`clone` of `ASTExistsDatabaseQuery`, `ASTShowCreateDatabaseQuery`, `ASTCreateIndexQuery`,
`ASTDropIndexQuery`, `ASTHypotheticalObjectQuery`, `ASTUpdateQuery` and `ASTDeleteQuery` cleared
`children` but did not call `cloneOutputOptions`. The clone kept the original's `out_file`,
`format_ast` and `settings_ast` pointers outside its own `children`, so it shared those nodes with
the original and hashed differently. The server-side AST fuzzer then failed with
`AST subtree not found in children` when removing `INTO OUTFILE` from a cloned `SHOW DATABASE`.

`UPDATE` and `DELETE` cloned `settings_ast` by hand; `cloneOutputOptions` now does it, and the
`UPDATE` clone follows the parser's children order.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131994&sha=4923e626ef1496323e70e737ee0b0cc34dc11d96&name_0=PR
PR: ClickHouse#131994

Co-Authored-By: Claude Opus 5.5 <[email protected]>
PedroTadim added a commit that referenced this pull request Nov 18, 2026
- `fuzzQueryText` and `fuzzStructure` fuzzed a freshly parsed AST, where the
  parser shares the `BETWEEN` subject between both comparisons, so the loop check
  aborted. `clone` it first, as the main fuzz paths do.
- The dolor HTTP server listens on IPv4 only, while BuzzHouse resolves `localhost`
  through `DNSResolver`, which picks `::1` or `127.0.0.1` at random per request, so
  `/sparkupdate` was sometimes refused. Bind it to `127.0.0.1`.

https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?PR=131994&sha=d065775f69ec5c8e87ee929bf4da68554b171059&name_0=PR
#131994

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@clickhouse-gh
clickhouse-gh Bot dismissed their stale review November 18, 2026 08:51

AI review of a later commit does not approve the PR, see the AI Review comment.

PR: #131994

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread tests/casa_del_dolor/oracles.py Resolved
Comment thread tests/casa_del_dolor/oracles.py Resolved
Comment thread src/Interpreters/executeQuery.cpp Resolved
PedroTadim and others added 3 commits November 19, 2026 15:14
On the framed HTTP path (`framing_output_format`), the fuzzer ran from `BlockIO::onFinish`, before the
framing finalization and the `query_finish_callback` that closes the response and releases the session.
Fuzzed queries kept the response open and the session locked, and with `send_logs_level` their logs were
streamed as `log` packets of the outer query. Now `executeQuery` runs the fuzzer after
`query_finish_callback` on both HTTP paths.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Comment thread tests/casa_del_dolor/oracles.py Resolved
PedroTadim and others added 4 commits November 20, 2026 09:38
With temporary data only in the distributed cache, merges that use temporary data fail with
`DISTRIBUTED_CACHE_ERROR` `no server is available` while the cache servers are not registered
in Keeper, e.g. after a restart or a Keeper session loss. The `part_log` health check counted them.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PedroTadim

Copy link
Copy Markdown
Member Author

@groeneai

Copy link
Copy Markdown
Collaborator

Acknowledged. I'm investigating it; I'll follow up here with a PR (or my findings) shortly.

What I see so far: the stress run itself never started. In the second configure of stress_runner.sh, tests/config/install.sh probes system.build_options with clickhouse local. The third probe (WITH_COVERAGE) printed the right answer 0, then the process died with SIGSEGV (exit 139), so install.sh aborted and test_results.tsv was never written (job.log lines 2678-2686). No stack trace was captured. Over the last 30 days this signature appears once in about 3,300 Stress test (arm_msan) runs (this head only), and the earlier heads of this PR passed the job, so a re-run will most likely pass.

@PedroTadim
PedroTadim enabled auto-merge November 20, 2026 14:54
A debug build checks every segment of each filesystem cache at startup
(`FileCache::assertCacheCorrectness` in `loadMetadataImpl`). With 26k tiny
segments it took over 3 minutes, so a scheduled restart overran
`SERVER_START_WAIT_SECONDS` and ended the run. The load drops segments past
`max_elements`, so capping it at 10000 bounds the check.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@PedroTadim
PedroTadim added this pull request to the merge queue Nov 20, 2026
Merged via the queue into master with commit f27b23b Nov 20, 2026
195 checks passed
@PedroTadim
PedroTadim deleted the more-fuzz16 branch November 20, 2026 18:21
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 20, 2026
@groeneai

Copy link
Copy Markdown
Collaborator

Follow-up: I opened #133286.

I could not reproduce the fault itself: 100,100 runs of the four install.sh probes with the job's THREAD_FUZZER_* environment on this PR's amd_msan binary all exited 0, and I found nothing in this PR's diff on the probe's path. What I did find is why it left no trace: Poco::Util::Application replaces the sanitizer's SIGSEGV handler at startup with an abort-only one, and HandledSignals::reset() at teardown then sets SIG_DFL, so a fault after it exits 139 with empty stderr. #133286 removes the Poco install and makes reset() restore the previous actions, so the next occurrence in a sanitizer job prints the sanitizer report with a stack.

mosya415 pushed a commit to mosya415/ClickHouse that referenced this pull request Nov 22, 2026
…of the fuzzer log

The La Casa Del Dolor job fails the run as `dolor.py exception` when
`Traceback (most recent call last):` appears in the last 20000 characters
of fuzzer.log (dolor.py's stdout and stderr), whatever dolor.py's exit
code. Four handlers in tests/casa_del_dolor/catalogs ignore an error on
purpose but called traceback.print_exc() before self.logger.exception(e),
so every ignored error also went to stderr as a traceback.

Since ClickHouse#131994 enabled RabbitMQ, Kafka and NATS in the job, the two
streamingtest.py handlers run in CI, and the fuzzed exchange redeclare
with a random type routinely gets 406 PRECONDITION_FAILED from the broker.
That made La Casa Del Dolor (amd_debug) red on PR ClickHouse#133383 although
dolor.py and the server both exited 0: the last ignored traceback started
14.8 KB before the end of fuzzer.log.

logger.exception already writes the message and the traceback to
dolor.log (dolor.py routes the root logger to --log-path only), so
print_exc() was a duplicate. Remove it at all four sites (streamingtest.py
create_table/update_table, tablecheck.py check_table, datagenerator.py
update_table; the last two are Spark-only and not run in CI yet) together
with the then unused `import traceback`. The safety net is unchanged and
still reports an exception nobody caught.

Validated locally by calling the four real handlers with the error
injected and the job's check applied to their output: on master all four
trip it, with the change stderr stays empty and dolor.log keeps the
traceback. No test for the test infrastructure.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
valerypetrov pushed a commit to valerypetrov/ClickHouse that referenced this pull request Nov 22, 2026
…ueue

La Casa Del Dolor (arm_asan_ubsan) on PR 133339 (sha 6e867ce) drew
`fcache0` as SLRU with `use_split_cache=1`, `split_cache_ratio=0.99`,
`slru_size_ratio=0.01` and `max_elements=1000`. `SplitFileCachePriority`
gives the data part lround(1000 * 0.01) = 10 elements, its protected SLRU
queue gets lround(10 * 0.01) = lround(0.1) = 0, and the
`SLRUFileCachePriority` constructor rejects a queue without elements:
"Cannot have zero max elements after ratio is applied" (BAD_ARGUMENTS),
so the server exits with code 36 and the run ends before any fuzzing.

174d412 ("Cap `max_elements` of the Dolor filesystem caches", in
ClickHouse#131994) lowered the generator floor of `max_elements` from 10000 to 1000.
With 10000 the worst case, both ratios at an extreme, was
10000 * 0.01 * 0.01 = 1; with 1000 it rounds to 0.

`normalize_cache_properties` already computes the smallest SLRU queue of
each split part with the server's rounding, to fit the file segment into
it. Factor that into `get_smallest_queue` and apply it to `max_elements`
too: raise it until every SLRU queue gets at least one element, staying
within `MAX_CACHE_ELEMENTS`. For the generated ratios (0.01 to 0.99) the
worst case needs 4950, by the server's `std::lround` and by the harness
rounding alike. The size logic is unchanged.

Measured with an oracle that re-implements the server's check with libm
`lround`: master's generator yields 1022 unstartable caches in 200000
seeded draws, this one 0; on 100000 seeds of both `filesystem_caches`
entries and cache disks, 1042 configs differ and every difference is only
`max_elements` of a cache master left unstartable. A master debug server
exits with code 36 on the CI cache block (protected queue 0 elements) and
starts with the normalized block (`max_elements` 4950; smallest queue
1 element).

Co-Authored-By: Claude Opus 5.5 <[email protected]>
subkanthi pushed a commit to subkanthi/ClickHouse that referenced this pull request Nov 23, 2026
…l Dolor paused

La Casa Del Dolor (amd_debug) failed with `dolor.py exception` on unrelated PRs:
`docker compose ... unpause postgres1` returned "Container ... is not paused".

Docker reports a paused container that has a healthcheck as unhealthy (pausing
closes its health monitor) and keeps that status after the unpause until the
next probe, which runs only after `interval` (10 s for postgres1). The postgres
compose file labels postgres1 `autoheal=true` and runs the
willfarrell/autoheal sidecar, which restarts every labelled unhealthy
container every 5 s after a 600 s start period (ClickHouse#79360). La Casa runs 15
minutes and pauses integrations since ClickHouse#131994, so a postgres pause after
minute 10 is restarted by the sidecar: the restart resumes the container and
the unpause fails. The dockerd debug logs of both failing runs show pause,
the sidecar's `health=unhealthy` query, `restart?t=10`, then the failed
unpause.

When dolor pauses postgres1 it now pauses the sidecar first, and resumes it
once postgres1 is healthy again. Resuming it right after the unpause is not
enough, because the status is still unhealthy until the first probe. The wait
is bounded at 60 s, after which the sidecar is resumed anyway, so a postgres
that stays unresponsive after a pause is still healed (the reason ClickHouse#79360 added
the sidecar).

Not chosen: pausing with SIGSTOP (`docker kill --signal`) freezes only the
postmaster, so established connections keep answering and clients see no
hang, which defeats the purpose of the pause; stopping the sidecar for the
whole run drops the recovery; making `unpause` tolerate a running container
would hide that the pause turned into an unscheduled restart.

Validated locally (no committed test: fuzzer harness change): with the
current sequence `unpause` fails 5/5; with the new one 5/5 runs have no
restart and no error, and postgres is healthy about 10 s after the unpause.
A temporary integration test on the real compose file reproduced the CI
exception after the 600 s start period and ran the new sequence 3/3 cleanly.

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

comp-fuzzing Fuzzers: BuzzHouse (the query generator in the client), the AST fuzzer (QueryFuzzer), and the lib... pr-ci 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