Repository navigation
Fix flaky 03636_benchmark_error_messages under LLVM coverage - #103668
Conversation
The test pipes `clickhouse-benchmark` stderr through `grep -v` filters that
strip the EXPECTED error texts (`Unrecognized option '--bad-option'`,
`Bad arguments: the argument ('bad value') for option '--timelimit' is
invalid`, `invalid user: Authentication failed`, `Positional option
'pos_arg' is not supported.`). Anything else that lands on stdout fails
the test via the "exception in stdout" detector in `clickhouse-test`.
Under `amd_llvm_coverage` builds the server is ~3-5x slower, and under
parallel test load the `clickhouse-benchmark` connection / handshake path
hits the internal 10 s budget set by `DBMS_DEFAULT_CONNECT_TIMEOUT_SEC`
(`src/Core/Defines.h`) and `handshake_timeout_ms = 10000`
(`src/Core/Settings.cpp`). When that timeout expires
`Connection::connect` rethrows a `Poco::TimeoutException` wrapped as
`NETWORK_ERROR` / `SOCKET_TIMEOUT`:
Code: 209. DB::NetException: Timeout exceeded while reading from
socket (peer: [::1]:9000, ..., 10000 ms): (localhost:9000, ::1,
local address: [::1]:NNNNN). (SOCKET_TIMEOUT)
That text is not in the `grep -v` filter list, so it leaks into stdout
and fails the test.
CIDB footprint (last 30 days): 16 failures across 13 distinct PRs, 4
master hits. 100% on `amd_llvm_coverage` variants
(`2/3`, `AsyncInsert, s3 storage, parallel`,
`ParallelReplicas, s3 storage, parallel`, and
`old analyzer, s3 storage, DatabaseReplicated, WasmEdge, parallel`),
0 on any non-coverage build. Every CI report shows
`Failed 0 out of 3 reruns`, confirming the flake is timing-related.
Apply `no-llvm-coverage`, the established pattern for the same class of
flake, also used by `02550_benchmark_connections_credentials` (PR
ClickHouse#103298), `01473_event_time_microseconds`, `03096_order_by_system_tables`,
`03258_nonexistent_db`, `04078_native_protocol_input_validation`,
`01514_distributed_cancel_query_on_error`, and
`02293_http_header_full_summary_without_progress`. The test continues to
run on every other build (debug, ASan + UBSan, TSan, MSan, release,
binary), so its `clickhouse-benchmark` argument-validation coverage is
preserved.
Example failing report:
https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=e964f640e43bd3a1c582d0f610de73085e0ecf40&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%202%2F3%29
|
Pre-PR validation gate (per worker policy): a) Deterministic repro under CI conditions. 16/16 CIDB failures in the last 30 days carry the exact b) Root cause explained. Under LLVM source-based coverage the server is ~3-5× slower; under parallel test load the c) Fix matches root cause. d) Test intent preserved. The test still runs on debug, ASan + UBSan, TSan, MSan, release, and binary builds. It's an argument-validation test for e) Both directions demonstrated.
f) Fix is general, not narrow. N/A — test-only flake fix, not a code bug fix. |
|
cc @azat — could you review this? Same root cause and fix pattern as PR #103298 (which you reviewed): |
|
Workflow [PR], commit [adad3b8] Summary: ✅ AI ReviewSummaryThis PR adds a ClickHouse Rules
Final Verdict
|
clickhouse-benchmark uses the default handshake_timeout_ms=10000 (10s) and connect_timeout=10s. On slow lanes (amd_tsan, s3 storage, parallel) the TLS handshake to the secure port can take longer than 10s under load, so the client aborts with Code: 209 DB::NetException Timeout exceeded (SOCKET_TIMEOUT) before certificate verification runs. That breaks both checks: the first invocation loses its expected "certificate verify failed" line, and the SOCKET_TIMEOUT text trips grep Exception in the second invocation. "Server died" is the harness verdict from the same slow-response window, not a crash. Add --connect_timeout 60 --handshake_timeout_ms 60000 to the benchmark invocations so the handshake has a generous budget on slow lanes. The test still verifies the same behavior: --secure without --accept-invalid-certificate still prints "certificate verify failed", and --secure --accept-invalid-certificate still succeeds with no exception. Same approach as 01600_benchmark_query (ClickHouse#108570) and 03636_benchmark_error_messages (ClickHouse#103298, ClickHouse#103668). Reported on ClickHouse#100332 by alexey-milovidov. Co-Authored-By: Claude Opus 4.8 <[email protected]>
clickhouse-benchmark uses the default handshake_timeout_ms=10000 (10s) and connect_timeout=10s. On slow lanes (amd_tsan, s3 storage, parallel) the TLS handshake to the secure port can take longer than 10s under load, so the client aborts with Code: 209 DB::NetException Timeout exceeded (SOCKET_TIMEOUT) before certificate verification runs. That breaks both checks: the first invocation loses its expected "certificate verify failed" line, and the SOCKET_TIMEOUT text trips grep Exception in the second invocation. "Server died" is the harness verdict from the same slow-response window, not a crash. Add --connect_timeout 60 --handshake_timeout_ms 60000 to the benchmark invocations so the handshake has a generous budget on slow lanes. The test still verifies the same behavior: --secure without --accept-invalid-certificate still prints "certificate verify failed", and --secure --accept-invalid-certificate still succeeds with no exception. Same approach as 01600_benchmark_query (ClickHouse#108570) and 03636_benchmark_error_messages (ClickHouse#103298, ClickHouse#103668). Reported on ClickHouse#100332 by alexey-milovidov. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Documentation entry for user-facing changes
Test
03636_benchmark_error_messagesis flaky underamd_llvm_coveragebuilds.Root cause
The test pipes
clickhouse-benchmarkstderr throughgrep -vfilters that strip the EXPECTED error texts (Unrecognized option '--bad-option',Bad arguments: the argument ('bad value') for option '--timelimit' is invalid,invalid user: Authentication failed,Positional option 'pos_arg' is not supported.). Anything else that lands on stdout fails the test via the "exception in stdout" detector inclickhouse-test.Under
amd_llvm_coveragebuilds the server is ~3-5x slower, and under parallel test load theclickhouse-benchmarkconnection / handshake path hits the internal 10 s budget set byDBMS_DEFAULT_CONNECT_TIMEOUT_SEC(src/Core/Defines.h) andhandshake_timeout_ms = 10000(src/Core/Settings.cpp). When that timeout expiresConnection::connect(src/Client/Connection.cpp:248) rethrows aPoco::TimeoutExceptionwrapped asNETWORK_ERROR/SOCKET_TIMEOUT:That text is not in the
grep -vfilter list, so it leaks into stdout and fails the test.Evidence
CIDB footprint (last 30 days): 16 failures across 13 distinct PRs, 4 master hits — 100 % on
amd_llvm_coverage, 0 on any non-coverage build:Stateless tests (amd_llvm_coverage, 2/3)Stateless tests (amd_llvm_coverage, AsyncInsert, s3 storage, parallel)Stateless tests (amd_llvm_coverage, ParallelReplicas, s3 storage, parallel)Stateless tests (amd_llvm_coverage, old analyzer, s3 storage, DatabaseReplicated, WasmEdge, parallel)Every CI report shows
Failed 0 out of 3 reruns, confirming the flake is timing-related, not a logic bug. Every failing log shows the exception with, 10000 ms)— the exactconnect_timeout/handshake_timeoutceiling.Fix
Apply
no-llvm-coverage— the established pattern for the same class of flake. The same fix was applied to the closely-related02550_benchmark_connections_credentialsin PR #103298 with identical root-cause analysis, and to other timing-sensitive flakes on the same variant:01473_event_time_microseconds,03096_order_by_system_tables,03258_nonexistent_db,04078_native_protocol_input_validation,01514_distributed_cancel_query_on_error,02293_http_header_full_summary_without_progress.The test continues to run on every other build (debug, ASan + UBSan, TSan, MSan, release, binary), so its
clickhouse-benchmarkargument-validation coverage is preserved. A deeper fix would require bumpingconnect_timeout/handshake_timeoutfor this test specifically, but that is outside the scope of a CI-stability fix and would complicate the test's semantics.Local verification on debug build (
amd_debug): 50/50 passes with full settings randomization enabled.Example failing report (master): https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=e964f640e43bd3a1c582d0f610de73085e0ecf40&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_llvm_coverage%2C%202%2F3%29
CI session: cron:clickhouse-ci-task-worker:20260428-094500
Version info
26.5.1.162