Repository navigation
Reduce flakiness of test_distributed_ddl_parallel and test_restore_replica - #108933
Conversation
…plica Both integration tests fail together under sanitizer load (asan/msan) with 0 master failures in 30 days; hits spread across unrelated PRs. test_smoke_parallel_dict_reload: the executable-dictionary sources slow_dict_3 and slow_dict_7 use the default 10s command_read_timeout. With 30 concurrent SYSTEM RELOAD DICTIONARY ON CLUSTER under sanitizer slowdown, the server thread can fail to read the command pipe within 10s and aborts with TIMEOUT_EXCEEDED 'Pipe read timeout exceeded', even though the command only sleeps 3-7s. Raise command_read_timeout to 60s on both dictionaries. The commands never approach 60s, so nothing is masked and the concurrency that exercises DDL queueing (above cluster_b.pool_size=20) is preserved. test_restore_replica: mutating queries (SYSTEM RESTART/RESTORE/SYNC REPLICA, INSERT) had no connection-level retry and fail with Connection refused when a node is transiently unreachable under sanitizer load. Add query_with_connect_retry that retries only on 'Connection refused'. Because that error means the TCP connection was rejected and the query never reached the server, retrying is safe even for the non-idempotent statements in these tests. Test-only change. No product code modified. Co-Authored-By: Claude Opus 4.8 <[email protected]>
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-worker-slot-6:20260630-114300 |
|
cc @tavplubix - could you review? Test-only flaky-test hardening: raises |
| def fill_nodes(nodes): | ||
| for node in nodes: | ||
| node.query("DROP TABLE IF EXISTS test SYNC") | ||
| query_with_connect_retry(node, "DROP TABLE IF EXISTS test SYNC") |
There was a problem hiding this comment.
@groeneai Did the CI failures report failures to connect or is this a precautionary measure?
There was a problem hiding this comment.
Real failures, not precautionary. The three test_restore_replica failures in the report on #108896 (Integration tests (amd_asan, old analyzer, 3/6), head 680c1a3) all raised:
Code: 210. DB::NetException: Connection refused (172.16.2.7:9000). (NETWORK_ERROR)
The refused address is the node's own native port, and the failing queries were plain single-node statements (DROP TABLE IF EXISTS test SYNC during fixture setup/teardown), so clickhouse-client could not open its connection and the query never reached the server. CIDB 30d: the same signature on 4 PRs, 0 on master.
I have tightened the helper (d50d0ef) so it retries only this exact case: QueryRuntimeException with return code 210 and Connection refused (<this node ip>:9000). Any other error, including a server-side or remote/Keeper refusal with a different address, is re-raised. See the reply to the automated review on the helper below.
|
Workflow [PR], commit [d50d0ef] Summary: ✅ AI ReviewSummaryThis is a test-only hardening PR: it raises the executable dictionary read timeout used by Final VerdictStatus: ✅ Approve |
Restrict query_with_connect_retry to a provable pre-query client connection failure: a NETWORK_ERROR (code 210) whose message reports "Connection refused (<node ip>:9000)" for the node's own address. In that case clickhouse-client never opened the connection, so the query never reached any server and retrying is safe even for non-idempotent statements (INSERT, SYSTEM RESTORE REPLICA ... ON CLUSTER). A server-side or downstream "Connection refused" (remote shard or Keeper) carries a different address and is now re-raised immediately, so an already-enqueued ON CLUSTER DDL or a partially-applied INSERT is never resubmitted. Co-Authored-By: Claude Opus 4.8 <[email protected]>
LLVM Coverage Report
Changed lines: No C/C++ source files changed — skipping uncovered code analysis. Newly covered by added/modified tests: 1116 line(s), 17 function(s) across 22 file(s) · Details Top files
|
CI finish ledger — d50d0efCI fully finished (Finish Workflow + Mergeable Check: success). This PR reduces flakiness of
Session id: cron:our-pr-ci-monitor:20260630-173000 |
03568_udf_memory_tracking fails sporadically on Stateless tests (amd_msan, WasmEdge, parallel, 2/2) with exit code 242 (UDF_EXECUTION_FAILED) wrapping "Code: 159 Pipe read timeout exceeded 10000 milliseconds". This is not a test timeout: the failing runs die in 13.7 s / 16.3 s / 27.3 s against the 600 s per-test limit. It is a per-invocation bound. test_function is declared with execute_direct=0 and no command_read_timeout, so ExternalUserDefinedExecutableFunctionsLoader.cpp:234 gives it the 10000 ms default. execute_direct=0 means every call vfork+execs /bin/sh -c "awk ...", and test_function is not an executable_pool, so a fresh pipe and process are created per call. The test uses max_block_size = 1 over numbers(40) and numbers(60), i.e. 100 independent fork/exec round-trips; that per-block shape is the coverage the test exists for. The read clock is armed independently of the writer's progress: ShellCommandSource spawns each SendDataTask on a separate thread and builds the input format over timeout_command_out immediately, so the 10 s budget covers vfork, exec, sh and awk startup plus the scheduling delay of our own writer thread. Under MSan in a loaded parallel bucket one round-trip can exceed it, and one slow read out of 100 fails the whole query. The two distinct throw sites across the reports (once while reading the header, twice inside ParallelParsingInputFormat) confirm a startup-window stall. PR ClickHouse#107699 cut the round-trips from 300 to 100. That lowers the number of dice rolls but leaves the per-roll ceiling untouched, which is why the failure carried over from TSan to MSan; trimming the workload again would attack the wrong term and erode coverage. Every assertion is unchanged: both memory checks, count() = 2, the 100-block workload and the reference file. Nothing is masked either: awk on one row is sub-millisecond work, all 100 round-trips take 0.43 s locally, and the bound stays finite at 60 s so a genuine hang still fails. The same knob at the same value already fixed the identical signature for executable dictionaries in ClickHouse#108933. Closes: ClickHouse#112994
…ibuted-ddl-parallel-and-restore-replica-flaky Reduce flakiness of test_distributed_ddl_parallel and test_restore_replica
Related: #108896
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
...
Description
Reduce flakiness of two integration tests that fail together under sanitizer load (asan/msan), reported on PR #108896 (CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=108896&sha=680c1a359cb1def9c09acf4dc2d33cc90466c3aa&name_0=PR&name_1=Integration%20tests%20%28amd_asan%2C%20old%20analyzer%2C%203%2F6%29). Both are CI-only flakes: 0 master failures in 30 days, hits spread across unrelated PRs (#107442, #107566, #107652, #108896). No tracking issue exists.
test_distributed_ddl_parallel::test_smoke_parallel_dict_reload fails with
Code: 159. TIMEOUT_EXCEEDED: Pipe read timeout exceeded 10000 milliseconds ... ShellCommandSource. Theslow_dict_3/slow_dict_7executable-dictionary sources rely on the defaultcommand_read_timeoutof 10s (ShellCommandSource.h). The test issues 30 concurrentSYSTEM RELOAD DICTIONARY ON CLUSTER, each spawning asleepcommand. Under sanitizer slowdown the server thread can fail to read the command pipe within 10s and aborts the load, even though the command itself only sleeps 3-7s. Fix: setcommand_read_timeoutto 60s on both dictionaries. The commands never approach 60s, so nothing is masked; the 30-thread concurrency that exercises DDL queueing (abovecluster_b.pool_size = 20) is preserved.Verified deterministically: a
sleep 3executable dict withcommand_read_timeout=2000reproduces the exactCode: 159 Pipe read timeout exceeded 2000 milliseconds ... ShellCommandSource; raising it to 60000 makes the same reload complete in ~3s and load the dictionary.test_restore_replica (parallel / sequential / keeps_duplicate_parts) fails with
Code: 210. NetException: Connection refused (NETWORK_ERROR)when a server node is transiently unreachable under sanitizer load (sibling subtests in the same run still pass, so the node recovers). The mutating queries (SYSTEM RESTART/RESTORE/SYNC REPLICA,INSERT) had no connection-level retry, whilecheck_dataalready retries viaassert_eq_with_retry. Fix: aquery_with_connect_retryhelper that retries only on "Connection refused". That error means the TCP connection was rejected and the query never reached the server, so retrying is safe even for the non-idempotentINSERT/SYSTEM RESTORE REPLICAstatements (including the dedup-window-0 inserts). Any other error is re-raised immediately.Verified deterministically: querying a closed port yields
Code: 210 Connection refused (NETWORK_ERROR); the helper retries while the node is down and succeeds the moment it becomes reachable.Test-only change (one dictionary config, one test file). No product code is modified.
Version info
26.7.1.427(included in26.7and later)