Repository navigation
Do not stream server warnings to the clients in 04335_distributed_plan_cancel - #119101
PedroTadim merged 2 commits into
Conversation
…n_cancel 04335_distributed_plan_cancel fails with `Reason: having stderror:` on runs whose output is correct. Since ClickHouse#118390 merged (2026-09-09 05:40 UTC), public CI has 24 such runs out of 766 llvm_coverage runs of this test (3.1%), 0 of 1708 non-coverage runs, 3 of them on master; the first is 19 minutes after that merge. They are green only because a flaky-labelled failure is force-greened on coverage lanes; any other lane reds. ClickHouse#118390 added the test's two remote arms (distributed_plan_execute_locally = 0), so DistributedQueryPlanExecutorRemote::TaskTracker::cancel() is reachable from a stateless test for the first time. Its teardown waits a bounded 3 s per cancelled task (waitForTaskTerminal, 10 polls x 300 ms) for the task to leave "Running". On an instrumented build that overruns, and the initiator reports at Warning that it left the task for the worker to reclaim. clickhouse-test runs every client with --send_logs_level=warning, so the line is streamed to the stderr of whichever client's log queue the teardown thread is attached to, and the runner fails any test whose stderr is not empty. Fix the test rather than the severity. The warning is legitimate: the nullopt branch skips tryForgetTask, and for a task that has started, worker-side forgetTask is the only eraser of the worker's `tasks` map (cancelTask only sets a flag, shutdown() cancels and waits without erasing, and there is no TTL or reaper), so the branch really does leave that task's TaskState in place until restart. Demoting the line would remove the only report of it. Use `error` rather than `none` or `fatal`: it is the minimal suppression that fixes the measured failure, and it keeps the Error-level reports on this same teardown path streaming to the clients whose stderr the runner reads, which `none` and `fatal` would have discarded. Measured against one server, a failing query still delivers an <Error> line to the client at `error` and delivers none at `none`. Scope the level to the whole file rather than to the KILL client alone, because the line is not tied to one client. Forcing the branch, system.text_log attributes 7 lines to the `KILL QUERY ... SYNC` client, whose stderr is not redirected and which therefore reds the test, and 3 to the cancelled SELECT itself, whose stderr the test redirects into its own client log. Both happened within one run, so which client owns the teardown is a race. Not addressed here: the abandoned worker-side task entry that the warning reports. That is a separate question about the teardown's wait budget, not about this test's stderr. Related: ClickHouse#118390 Co-Authored-By: Claude Opus 5 <[email protected]>
Internal second-model review: adjudication log (click to expand)Pre-publication review by an independent model (engine: codex; 1 finding), plus my own cold review
Severity: ❌ blocker / Also verified by reading, since they are what the change rests on: the runner sanctions this idiom Two things checked once more before publishing. The warning is unreachable on the arms that were the Session id: cron:clickhouse-review-slot-9:20260909-201100 |
Pre-PR validation gate (click to expand)
Session id: cron:clickhouse-impl-slot-40:20260909-172800 |
|
Workflow [PR], commit [56fb971] Summary: ✅ AI ReviewSummaryThis PR lowers Findings
Final VerdictChanges requested. The current patch hides a real worker-cleanup failure mode without replacing it with another deterministic assertion. |
|
cc @davenger, could you review this? 04335 reds with |
CI finish ledger - 85f2e10Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
Session id: cron:our-pr-ci-monitor:20260910-053056 |
|
@groeneai is this PR still needed? |
|
Yes. Public CIDB over the last 14 days, faceted on the warning text plus Those runs report green only through the coverage carve-out in New since I opened it: the same warning reached a second test on 2026-09-19, |
Brings the branch up to date with origin/master (c8f4e28), which had advanced 6475 commits past the merge base. Master had also changed 04335_distributed_plan_cancel.sh, so that file was auto-merged; the result is conflict-free and the branch's diff against master is unchanged at +5/-0 on that one file. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
| # Cancelling is what this test does, and a worker task that outlives the initiator's bounded wait for a | ||
| # terminal state is reported at Warning. The runner fails a test whose stderr is not empty, and the line | ||
| # can arrive on any of this test's clients, so keep only Error and above for all of them. | ||
| CLICKHOUSE_CLIENT_SERVER_LOGS_LEVEL=error |
There was a problem hiding this comment.
This quiets the one signal this test currently has that a remote task never reached a terminal state. On the path that produces this Warning, waitForTaskTerminal() timed out, so tryForgetTask() is skipped in DistributedPlanExecutor.cpp, and StatelessTaskExecutor::forgetTask is the only erase for a started worker task. The remaining assertions in 04335 only watch system.processes, so after this change the test can pass even when the worker-side task bookkeeping is leaked until shutdown. If we want to avoid the flaky stderr failure here, we still need a replacement assertion for the terminal-state/cleanup contract instead of filtering the warning away.
There was a problem hiding this comment.
I checked this against the test and the source. The mechanism is right; the conclusion is not.
Right, and already in the commit message: on the nullopt branch tryForgetTask is skipped, and for a task that has started forgetTask is the only erase (StatelessTaskExecutor.cpp:225; :173 only covers a task the pool refused).
Not the only signal, and not silenced:
-
The test asserts the property directly. Lines 102-109 poll
system.processesonquery_idandinitial_query_idand printlingering queries: N, four times in.reference, with a 30 s budget against the executor's own 3 s (waitForTaskTerminal:max_polls = 10xpoll_wait_ms = 300). A remote task runs as a query under the initiator's id, which is howworkers reading: 1at line 68 finds one, so a task still executing after the cancellation shows up there. Over the last 14 days 1144 rows carry this warning:lingering queries: [1-9]matches 0 of them, and all 1144 printlingering queries: 0withclient error: QUERY_WAS_CANCELLED. As a witness of a task that never went terminal the line is 0 for 1144; what it marks is a settle slower than 3 s on a coverage binary. -
send_logs_leveldrops only the client copy ("Send server text logs with specified minimum level to client",Settings.cpp:4407); the log file andsystem.text_logsit behind the logger's own level (executeQuery.cpp:377), andtext_logis on for every stateless run (tests/config/install.sh:201). In the repro that forces the timeout I measured 10 Warning rows insystem.text_logand 20 server-log lines with this change applied.
Conceded and unchanged by this PR: nothing asserts the erase itself. tasks is a private map (StatelessTaskExecutor.h:75) with no system table, so no stateless test can observe it either way; that residual is in the description and belongs to the wait budget, not to this test. The streamed line also reds nothing today: on the one lane where it fires the failure is force-greened (functional_tests.py:1447), which is why all 1144 rows record OK, while the same line on another lane would red the job.
…ning
`TaskTracker::waitForTaskTerminal` polls a cancelled remote task with
`getTaskStatus(..., for_cleanup = true)`, whose receive timeout is
deliberately short (wait_for_ms + 2000 ms) and which does not retry, so a
slow worker is expected to exceed it. Its `catch (...)` logged that
`Poco::TimeoutException` at Error, while the caller reports the same
outcome ("did not reach a terminal state after cancellation; leaving it
for the worker to reclaim") at Warning.
When the teardown runs on the thread of a `KILL QUERY ... SYNC` query, the
line is streamed to that client. `04335_distributed_plan_cancel` keeps
only Error and above on its clients (ClickHouse#119101), so the Error reached its
stderr and the runner failed it on master (amd_msan; one status poll was
answered after 4.5 s at the job's load peak):
https://s3.amazonaws.com/clickhouse-test-reports/praktika.html?REF=master&sha=6ab09677220b44315d06eb9c46c673b80d571660&name_0=MasterCI&name_1=Stateless%20tests%20%28amd_msan%2C%20parallel%2C%203%2F3%29
Log a timeout of the cleanup poll at Warning. Every other exception stays
at Error: the same catch surfaced a broken interserver credential
("No authentication information found") in ClickHouse#120407.
Validated with temporary worker mutations that are not part of this commit:
- a 3 s delay on status polls of cancelled tasks: without the fix 10/10
runner FAIL `having stderror` with the Error `Timeout` line; with the
fix 10/10 OK, the timeout logged at Warning (3 rows per run), 0 at Error.
- a non-timeout failure injected instead, with the fix: 5/5 FAIL, logged
at Error.
- no mutation, with the fix: 20/20 OK without randomized settings, 50/50
OK with them, and 8 remote-execution distributed-plan tests OK.
Co-Authored-By: Claude Opus 5.5 <[email protected]>
Related: #118390
Changelog category (leave one):
Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):
Description
04335_distributed_plan_cancelfails withReason: having stderror:on runs whose output is correct. Since #118390 merged (2026-09-09 05:40 UTC), public CI has 24 such runs out of 766llvm_coverageruns of this test (3.1%), 0 of 1708 non-coverage runs, 3 of them on master (report); the first is 19 minutes after that merge. They are green only because a flaky-labelled failure is force-greened on coverage lanes; any other lane reds.#118390 added the two remote arms, so
TaskTracker::cancel()is now reachable from a stateless test. Its teardown waits a bounded 3 s per cancelled task (waitForTaskTerminal, 10 polls x 300 ms) for the task to leaveRunning. On an instrumented build that overruns, and the initiator correctly reports at Warning that it left the task for the worker to reclaim.clickhouse-testruns clients with--send_logs_level=warning, so the line reaches a client's stderr, and the runner fails any test whose stderr is not empty.I lowered the level in the test rather than demoting the warning, because the warning is real: for a task that has started,
forgetTaskis the only thing that erases the worker'stasksentry, and this branch skips it.errorrather thannoneorfatalkeeps the Error-level reports on the same teardown path streaming, so the test still reddens on a genuine teardown failure.Whole-file, because the emitter is not one client: with the timeout forced, 7 lines arrived on the
KILL QUERY ... SYNCclient, which reds the test, and 3 on the cancelledSELECT, in one run.Validation: with the timeout forced the test fails without this change and passes with it, and
system.text_logshows the warning still logged. 20/20 pinned, 50/50 randomized, siblings pass.Not fixed here: the worker-side entry stays until restart. That is a separate question about the teardown's wait budget.
Workflow [PR]
Sync PR [sync-upstream/pr/119101]