Skip to content

Count only LOGICAL_ERROR in the text_log check of 05453_webterminal_close_during_insert - #128545

Merged
alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-05453-webterminal-text-log-parallel-safe
Nov 2, 2026
Merged

alexey-milovidov merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-05453-webterminal-text-log-parallel-safe

Conversation

@groeneai

@groeneai groeneai commented Nov 1, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #127834

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):

Fix the flaky test 05453_webterminal_close_during_insert when it runs in parallel with other tests.

Description

05453_webterminal_close_during_insert failed on PR #120908 (job): the last check expected 0 error records with Cannot write to canceled buffer in system.text_log and got 2.

The check counts such records in the whole server since the test started. The same text is also the ordinary CANNOT_WRITE_AFTER_BUFFER_CANCELED (734) of WriteBuffer::writeSlow(const char *, size_t), while the bug the test guards is the LOGICAL_ERROR of writeSlow(char). In that job both records were Code 734 from the concurrent test 01513_optimize_aggregation_in_order_memory_long (a parallel replicas follower writing into a canceled connection buffer).

The check now counts only message LIKE '%Cannot write to canceled buffer%(LOGICAL_ERROR)%'. The % before the code name is needed because the pipeline executors also log the error with context (...buffer: While executing ValuesBlockInputFormat. (LOGICAL_ERROR)).

Validation on master release builds with abort_on_logical_error = 0, plus a concurrent loop of Code 734 errors with the same text:

🤖 Generated with Claude Code


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

Version info

  • Merged into: 26.11.1.1085-master (included in 26.11 and later)

…nal_close_during_insert`

The last check of the test counted every `Error` record of the whole server containing
`Cannot write to canceled buffer` since the test started. The same text is used by the ordinary
`CANNOT_WRITE_AFTER_BUFFER_CANCELED` (734) that `WriteBuffer::writeSlow(const char *, size_t)`
throws, so a concurrent test getting a legitimate Code 734 failed this test. On PR ClickHouse#120908 the
two counted rows came from `01513_optimize_aggregation_in_order_memory_long` (a parallel replicas
follower writing into a canceled connection buffer).

Count only the `LOGICAL_ERROR` form of the message, the bug the test guards. The error may be
logged with context (`While executing ValuesBlockInputFormat`) between the text and the error
code name, so the pattern allows anything in between.

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

groeneai commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author
Internal second-model review: adjudication log (click to expand)

Pre-publication review by an independent model (engine: codex; 0 findings) plus my own review (1 nit).

# Sev Finding Verdict Evidence / action
1 💡 If clearProgressOutput ran on the canceled buffer before the next writeProgress, a regression could log only the Code 734 form, which the new pattern no longer counts AGREE, noted, not blocking Not observed: before #127834 the new check counted the same records as the old one in 10/10 runs. The Code 734 text cannot be told apart from a concurrent test's error without scoping by query_id, which is a one-line swap if preferred.

Severity: ❌ blocker / ⚠️ major / 💡 nit. DISAGREE verdicts carry recorded evidence and are
terminal per finding.

Session id: cron:clickhouse-review-slot-8:20261101-230900

@clickhouse-gh

clickhouse-gh Bot commented Nov 1, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e22c793]

Summary: ✅


AI Review

Summary

PR #128545 narrows the final assertion in 05453_webterminal_close_during_insert to LOGICAL_ERROR, excluding ordinary CANNOT_WRITE_AFTER_BUFFER_CANCELED exceptions from concurrent tests. No actionable findings at e22c793ff3b63a59ab23ba15715b02d5d2167a40. The reported before/after validation supports preserving regression coverage. No local tests were run; targeted CI jobs are still in progress.

Final Verdict

✅ Approve. No changes requested.

@groeneai

groeneai commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. Release server after #127834 (553f2289, abort_on_logical_error = 0) plus a concurrent loop of SELECT throwIf(1, 'Cannot write to canceled buffer', toInt32(734)) SETTINGS allow_custom_error_code_in_throwif = 1: the unchanged test fails 4/4 (-0 +12..+16), the same shape as the CI failure.
b Root cause explained? The last check counts every Error record of the whole server with Cannot write to canceled buffer. That text is shared by the ordinary CANNOT_WRITE_AFTER_BUFFER_CANCELED (734, WriteBuffer::writeSlow(const char *, size_t)) and the LOGICAL_ERROR of writeSlow(char) that the test guards. On PR #120908 both counted records were Code 734 from the concurrent 01513_optimize_aggregation_in_order_memory_long.
c Fix matches root cause? Yes. The check now counts only '%Cannot write to canceled buffer%(LOGICAL_ERROR)%', the form of the guarded bug. No tags, no widened bound, no no-parallel.
d Test intent preserved / new tests added? Yes. Before #127834 (9efc32dc) the new check still fails 5/5 and counts exactly what the old one counts (1 or 4 records per run, including the executor rows ...buffer: While executing ValuesBlockInputFormat. (LOGICAL_ERROR)). Test-only change, no new test needed.
e Both directions demonstrated? Yes. With the Code 734 loop: old check FAIL 4/4, new check OK 3/3. Without the loop on 553f2289: 20/20 OK. Debug build (c189bd99) with random settings: 50/50 OK.
f Fix is general across code paths? Yes. Both logging paths of the bug (~Exception via ForcedCriticalErrorsLogger, and PipelineExecutor / PullingAsyncPipelineExecutor with context) end in (LOGICAL_ERROR), because getExceptionMessageAndPattern always appends the code name after the text. The other checks of the test are already scoped to the test's own log_comment and database.
g Fix generalizes across inputs (params/datatypes/wrappers)? N/A (test-only change to one text_log predicate).
h Backward compatible? (maintainer-approved exception only) N/A (test-only, no settings or formats).
i Invariants and contracts preserved? The test still fails on any record of the guarded LOGICAL_ERROR, and the level filter still excludes the text of the check query itself (logged at Debug). On builds that abort on LOGICAL_ERROR the bug still kills the server, as before.

Session id: cron:clickhouse-impl-slot-41:20261101-225600

@groeneai

groeneai commented Nov 1, 2026

Copy link
Copy Markdown
Collaborator Author

cc @azat, could you review this and add the can be tested label so CI runs? The last check of 05453_webterminal_close_during_insert counted every server-wide Cannot write to canceled buffer error, so a concurrent test's ordinary Code 734 failed it; it now counts only the LOGICAL_ERROR form the test guards.

@alexey-milovidov alexey-milovidov self-assigned this Nov 1, 2026
@clickhouse-gh clickhouse-gh Bot added the comp-testing Test content only (no production code). label Nov 2, 2026
@alexey-milovidov alexey-milovidov added the can be tested Allows running workflows for external contributors label Nov 2, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Nov 2, 2026
Merged via the queue into ClickHouse:master with commit aa863c3 Nov 2, 2026
529 of 531 checks passed
@robot-ch-test-poll2 robot-ch-test-poll2 added the pr-synced-to-cloud The PR is synced to the cloud repo label Nov 2, 2026
@clickhouse-gh clickhouse-gh Bot added comp-io IO library: ReadBuffer / WriteBuffer and their implementations over files and memory, read and wr... and removed comp-testing Test content only (no production code). labels Nov 22, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

can be tested Allows running workflows for external contributors comp-io IO library: ReadBuffer / WriteBuffer and their implementations over files and memory, read and wr... 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