Repository navigation
Conversation
|
Pre-PR validation gate (per
session: cron:clickhouse-ci-task-worker:20260513-031500 |
|
cc @alexey-milovidov @azat — could you review this? Closes the chronic stress-smoke-check flake by extending the outer retry in |
|
Workflow [PR], commit [b55839a] Summary: ✅ AI ReviewSummaryThis PR moves stress-test Missing context / blind spots
Findings
Tests
Final VerdictStatus: Minimum required action: make the late |
azat
left a comment
There was a problem hiding this comment.
@groeneai the query failed not because of network issues likely, but because of an exception on the server and how we pass them in HTTP protocol - we simply break protocol to make sure that the user will not be able to read it
2026.05.12 20:27:16.633642 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Test> HTTPServerRequest: Returning request input stream with ref count 1
2026.05.12 20:27:16.633689 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> HTTPServerRequest: creating in_post id 246771651929488
2026.05.12 20:27:16.634287 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> executeQuery: (from [::1]:46990) CREATE DATABASE IF NOT EXISTS test_5 ON CLUSTER test_cluster_database_replicated ENGINE=Replicated('/test/clickhouse/db/test_5', '{shard}', '{replica}') (stage: Complete)
2026.05.12 20:27:16.634452 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Test> CancellationChecker: Added to set. query: CREATE DATABASE IF NOT EXISTS test_5 ON CLUSTER test_cluster_database_replicated ENGINE=Replicated('/test/clickhouse/db/test_5', '{shard}', '{replica}')
2026.05.12 20:27:16.635922 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Information> DDLWorker: Creating replica dir for host id localhost:9000
2026.05.12 20:27:16.638483 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Test> QueryMetricLog: Scheduling next collecting task for query_id 04d9c38f-44fe-4137-8de3-5cdc28823f08 in 995 ms
2026.05.12 20:27:16.654606 [ 6594 ] {4edc3d6a-e353-416b-8f13-6894c60d6fcb} <Debug> executeQuery: (from 0.0.0.0:0, user: , initial_query_id: 04d9c38f-44fe-4137-8de3-5cdc28823f08) /* ddl_entry=query-0000000001 */ CREATE DATABASE IF NOT EXISTS test_5 UUID '813f2ae0-55a2-4b40-8789-6870daa03a55' ENGINE = Replicated('/test/clickhouse/db/test_5', '{shard}', '{replica}') (stage: Complete)
2026.05.12 20:27:16.939596 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Trace> DDLOnClusterQueryStatus: ZooKeeperRetriesControl: executeDistributedQueryOnCluster: setKeeperError: error=Connection loss message=Coordination error: Connection loss
2026.05.12 20:27:16.939745 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> DDLOnClusterQueryStatus: ZooKeeperRetriesControl: executeDistributedQueryOnCluster: will retry due to error: retry_count=1/5 timeout=100ms error=Connection loss message=Coordination error: Connection loss
2026.05.12 20:27:17.039890 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> Context: Trying to establish a new connection with ZooKeeper
2026.05.12 20:27:17.040592 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Trace> ZooKeeperClient: Adding ZooKeeper host 127.0.0.1:9181 (127.0.0.1:9181), az: UNKNOWN, priority: 0
2026.05.12 20:27:17.044916 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Information> ZooKeeperClient: Connected to ZooKeeper at 127.0.0.1:9181 with session_id 4
2026.05.12 20:27:17.045659 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag FILTERED_LIST: enabled
2026.05.12 20:27:17.045714 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag MULTI_READ: enabled
2026.05.12 20:27:17.045736 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag CHECK_NOT_EXISTS: disabled
2026.05.12 20:27:17.045754 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag CREATE_IF_NOT_EXISTS: disabled
2026.05.12 20:27:17.045775 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag REMOVE_RECURSIVE: disabled
2026.05.12 20:27:17.045796 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag MULTI_WATCHES: enabled
2026.05.12 20:27:17.045816 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag CHECK_STAT: enabled
2026.05.12 20:27:17.045835 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag PERSISTENT_WATCHES: enabled
2026.05.12 20:27:17.045855 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag CREATE_WITH_STATS: disabled
2026.05.12 20:27:17.045875 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag TRY_REMOVE: enabled
2026.05.12 20:27:17.045899 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag LIST_WITH_STAT_AND_DATA: enabled
2026.05.12 20:27:17.045940 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> ZooKeeperClient: Keeper feature flag GET_CHILDREN_RECURSIVE: enabled
2026.05.12 20:27:17.046002 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Trace> ZooKeeper: Initialized, hosts: 127.0.0.1:9181
2026.05.12 20:27:17.047018 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Information> ZooKeeperClient: ZK send fault: 0.002%
2026.05.12 20:27:17.047093 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Information> ZooKeeperClient: ZK recv fault: 0.002%
2026.05.12 20:27:17.047177 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Information> ZooKeeperClient: ZK send sleep: 0.001% -> 10000ms
2026.05.12 20:27:17.047265 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> Context: Establishing a new connection with ZooKeeper took 7 ms
2026.05.12 20:27:17.047759 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> DDLOnClusterQueryStatus: ZooKeeperRetriesControl: executeDistributedQueryOnCluster: succeeded after: Iterations=2 Total keeper failures=1/5
2026.05.12 20:27:17.636039 [ 5850 ] {BgSchPool::a4a0b078-a49b-4376-aad5-96c740226e96} <Test> QueryMetricLog: Collecting query_metric_log for query 04d9c38f-44fe-4137-8de3-5cdc28823f08 and interval 1000 ms with QueryStatusInfo from 2026.05.12 18:27:17.633613. Next collection time: 2026.05.12 18:27:18.633762
2026.05.12 20:27:17.636141 [ 5850 ] {BgSchPool::a4a0b078-a49b-4376-aad5-96c740226e96} <Test> QueryMetricLog: Scheduling next collecting task for query_id 04d9c38f-44fe-4137-8de3-5cdc28823f08 in 997 ms
2026.05.12 20:27:17.952176 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Test> HTTPServerRequest: Request stream is not shared, can keep alive connection
2026.05.12 20:27:17.953715 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Test> QueryMetricLog: Collecting query_metric_log for query 04d9c38f-44fe-4137-8de3-5cdc28823f08 and interval 1000 ms with QueryStatusInfo from 2026.05.12 18:27:17.953371. Next collection time: finished
2026.05.12 20:27:18.154313 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Error> executeQuery: Code: 722. DB::Exception: There was an error on [localhost:9000]: Code: 722. DB::Exception: Waited job failed: Code: 695. DB::Exception: Load job 'startup Replicated database test_5' failed: Code: 439. DB::Exception: Cannot schedule a task: fault injected (threads=841, jobs=826). (CANNOT_SCHEDULE_TASK),. (ASYNC_LOAD_WAIT_FAILED) (version 26.5.1.572). (ASYNC_LOAD_WAIT_FAILED) (version 26.5.1.572) (from [::1]:46990) (in query: CREATE DATABASE IF NOT EXISTS test_5 ON CLUSTER test_cluster_database_replicated ENGINE=Replicated('/test/clickhouse/db/test_5', '{shard}', '{replica}') ), Stack trace (when copying this message, always include the lines below):
2026.05.12 20:27:18.155831 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Test> CancellationChecker: Removing query 04d9c38f-44fe-4137-8de3-5cdc28823f08 from done tasks
2026.05.12 20:27:18.160259 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Error> DynamicQueryHandler: Code: 722. DB::Exception: There was an error on [localhost:9000]: Code: 722. DB::Exception: Waited job failed: Code: 695. DB::Exception: Load job 'startup Replicated database test_5' failed: Code: 439. DB::Exception: Cannot schedule a task: fault injected (threads=841, jobs=826). (CANNOT_SCHEDULE_TASK),. (ASYNC_LOAD_WAIT_FAILED) (version 26.5.1.572). (ASYNC_LOAD_WAIT_FAILED), Stack trace (when copying this message, always include the lines below):
2026.05.12 20:27:18.160767 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> WriteBufferFromHTTPServerResponse: Write buffer has been canceled with an error.Error has been sent at the end of the response. HTTP protocol has been broken by server. HTTP code: , message: <Internal Server Error>, error code: 722, message: <Code: 722. DB::Exception: There was an error on [localhost:9000]: Code: 722. DB::Exception: Waited job failed: Code: 695. DB::Exception: Load job 'startup Replicated database test_5' failed: Code: 439. DB::Exception: Cannot schedule a task: fault injected (threads=841, jobs=826). (CANNOT_SCHEDULE_TASK),. (ASYNC_LOAD_WAIT_FAILED) (version 26.5.1.572). (ASYNC_LOAD_WAIT_FAILED) (version 26.5.1.572)>. use compression: true, data has been send through buffers: true, compression discarded data: 0, discarded data: 0
2026.05.12 20:27:18.161105 [ 6825 ] {04d9c38f-44fe-4137-8de3-5cdc28823f08} <Debug> MemoryTracker: Query peak memory usage: 4.00 MiB.
And the problem is not clickhouse-test, but stress.py
So instead of your fix, let's do a different thing:
- start server w/o fault injection (do not install
tests/config/config.d/cannot_allocate_thread_injection.xml) - run this two tests to make sure that it works
- install
tests/config/config.d/cannot_allocate_thread_injection.xml - do
system reload config(with retries, since now it can throw) - cleanup error handling in
stress.py, likeCANNOT_SCHEDULE_TASK
Per @azat's review on ClickHouse#104782: the smoke-check failure mode is not a transport-layer transient — the server deliberately breaks the chunked HTTP response after an exception fires server-side (`WriteBufferFromHTTPServerResponse: HTTP protocol has been broken by server`), so retrying the truncated response on the client would mask a real server failure rather than fix one. The right fix is in the stress runner: don't enable thread-pool fault injection before the smoke check runs. That follow-up lives in the next commit. This reverts the `tests/clickhouse-test` portion of 515c714.
|
Thanks for the careful review — you're right, the previous version had the wrong shape. Replaced it with the approach you sketched:
Reverted the previous Mechanism-level validation ( session: cron:clickhouse-ci-task-worker:20260514-064500 |
azat
left a comment
There was a problem hiding this comment.
- Comments are too verbose, compact them
- No need to add separate option to stress.py, it should be done always
|
@groeneai please continue |
- Remove --enable-thread-pool-fault-injection from stress.py; install the config unconditionally after the smoke check (gated on not upgrade_check so upgrade tests keep their current behavior: thread-pool fault injection was never active there). - Compact verbose comments in stress.py and stress_runner.sh per @azat's request. See ClickHouse#104782 (review)...
|
Thanks. Both asks addressed in
Net effect on the PR: +21/-81 vs the previous tip. Awaiting CI + re-review. |
|
|
||
| logging.info("Installing thread-pool fault-injection config: %s -> %s", src, dst) | ||
| subprocess.run(["ln", "-sf", src, dst], check=True) | ||
| call_with_retry(make_query_command("SYSTEM RELOAD CONFIG"), timeout=30, retry_count=5) |
There was a problem hiding this comment.
install_thread_pool_fault_injection is supposed to activate cannot_allocate_thread_fault_injection_probability, but call_with_retry does not signal failure when all retries are exhausted. If SYSTEM RELOAD CONFIG keeps failing, this code silently proceeds and the stress run continues without thread-pool fault injection enabled, which weakens the test and can hide regressions.
Please make this step fail-close: either make call_with_retry raise/return failure on the last attempt and check it here, or explicitly verify after reload that the setting is active and raise if not.
There was a problem hiding this comment.
This is still not fully fail-close in the current code. install_thread_pool_fault_injection still discards the result of SYSTEM RELOAD CONFIG at ci/jobs/scripts/stress/stress.py:264, and the follow-up query reads system.server_settings, which is reconstructed from the already-replaced config via StorageSystemServerSettings::fillData.
The main reload callback calls config().replace before the long update sequence and before CannotAllocateThreadFaultInjector::setFaultProbability. If that updater throws after the config replacement but before the injector assignment, this query can report 0.0001 while the process-global injector is still 0.
Please require SYSTEM RELOAD CONFIG itself to succeed at least once, for example by making this local retry loop raise or return failure, before accepting the system.server_settings check.
azat
left a comment
There was a problem hiding this comment.
Mostly good, but the review comment should be addressed
`call_with_retry` returns silently after exhausting retries, so a persistent `SYSTEM RELOAD CONFIG` failure left `cannot_allocate_thread_fault_injection_probability` at 0 and the stress run continued without thread-pool fault injection enabled. Verify the setting is non-zero after reload and raise `RuntimeError` otherwise. Per @azat review on PR ClickHouse#104782 endorsing clickhouse-gh[bot]'s fail-close ask.
|
Addressed in 766f407 on top of the existing branch.
Validation ( session: cron:clickhouse-ci-task-worker:20260605-031200 |
|
@groeneai squash all changes into one commit, remove all the water from the description of the commit and PR, keep only important things, stick to https://www.linfo.org/rule_of_silence.html |
The stress smoke check runs CREATE DATABASE ... ON CLUSTER. With thread-pool fault injection enabled before the server starts, it could hit CANNOT_SCHEDULE_TASK while the Replicated database loaded; the server then broke the chunked HTTP response and the whole stress job aborted (recurring ~weekly across unrelated PRs). stress_runner.sh no longer exports THREAD_POOL_FAULT_INJECTION before the server starts. stress.py installs cannot_allocate_thread_injection.xml and reloads config only after the smoke check passes, then verifies cannot_allocate_thread_fault_injection_probability is non-zero (fail-close). The upgrade check keeps its previous behavior of running without it.
766f407 to
b55839a
Compare
|
@azat done. Squashed to one commit ( |
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Not required, CI infrastructure fix.
Description
The stress smoke check runs
CREATE DATABASE ... ON CLUSTER. With thread-pool fault injection enabled before the server starts, it could hitCANNOT_SCHEDULE_TASKwhile the Replicated database loaded; the server then broke the chunked HTTP response and the whole stress job aborted (a chronic ~weekly flake across unrelated PRs).stress_runner.shno longer exportsTHREAD_POOL_FAULT_INJECTIONbefore the server starts.stress.pyinstalls the config and reloads it only after the smoke check passes, then verifiescannot_allocate_thread_fault_injection_probabilityis non-zero (fail-close). The upgrade check keeps running without it.Related: #96844
Version info
26.6.1.674