Skip to content

Filter LLVM Profile Error noise from cancel-insert-when-client-dies tests - #110716

Closed
groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/04365-filter-llvm-profile-noise
Closed

groeneai wants to merge 3 commits into
ClickHouse:masterfrom
groeneai:groeneai/04365-filter-llvm-profile-noise

Conversation

@groeneai

@groeneai groeneai commented Jul 16, 2026 •

Copy link
Copy Markdown
Collaborator

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

Description

Four cancel-insert tests (02434, 02435, 04365, 04366) fail on Stateless tests (amd_llvm_coverage_per_test, per_test_coverage) with result differs with reference, where the diff's added lines are LLVM Profile Error: messages rather than wrong test output. The cancellation counts are correct.

Root cause: thread_cancel SIGKILLs coverage-instrumented clickhouse-client processes mid-insert. On abnormal death those clients emit LLVM Profile Error: ... to stderr (profraw merge-pool contention, see #97020). clickhouse-test strips those lines from a client's stderr only; thread_insert merges client stderr into stdout via 2>&1 and filtered just Killed (plus session noise in 02435), so the lines survived into the test's stdout and broke the reference diff.

Fix: extend each thread_insert filter with grep -Fav "LLVM Profile Error:". A repo-wide sweep of stateless .sh tests that signal-kill processes and merge output with 2>&1 confirms these four are the complete carrier set: the other candidates either capture into a variable and positively grep for Received from (01169 pair), redirect client output to a file or /dev/null (03776, 03803, 04003, 04051, 04052), or filter on Exception: (02443).

02435 was added after clickhouse-gh[bot] pointed it out on this PR; it has 3 master failures of this exact signature (2026-06-15, 2026-07-16, 2026-07-17).

Validation: this check runs only in NightlyCoverage (ci/workflows/nightly_coverage.py, Event.SCHEDULE, master), so it cannot run on this PR. Instead, each test's committed filter chain was extracted from the file and driven against the verbatim CI-captured stdout: post-fix output matches the reference byte-for-byte; removing the new filter reproduces the failure (so it is load-bearing); and a real DB::Exception line is preserved, confirming only the profiler noise is dropped. 12/12 assertions pass across the four tests.

Report (04365, 2026-07-28 master): https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=4a44dcefc451d3da3f7a9e7c8a38f74180b34ebc&name_0=NightlyCoverage&name_1=Stateless%20tests%20%28amd_llvm_coverage_per_test%2C%20per_test_coverage%2C%208%2F8%29

Prior PR #108343 widened the final cancel-message matcher (a separate genuine gap); the recurrence was this stdout pollution.

On amd_llvm_coverage_per_test builds, thread_cancel SIGKILLs coverage-instrumented
clickhouse-client processes mid-insert. On abnormal death those clients print
'LLVM Profile Error:' lines to stderr (profraw merge-pool contention, see ClickHouse#97020).
clickhouse-test filters these from a client's stderr, but thread_insert merges
client stderr into stdout via '2>&1' and only filtered 'Killed', so the LLVM lines
leaked into the test's stdout and produced a 'result differs with reference' diff.
The cancellation count itself was correct.

Extend the thread_insert filter to also drop 'LLVM Profile Error:' lines, in all
three sibling tests (02434, 04365, 04366) which share the identical pattern.

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

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. The polluting lines are LLVM Profile Error: on stderr from SIGKILL'd coverage clients, merged into stdout via 2>&1. Reproduced the exact filter mechanism deterministically: { echo Killed; echo "LLVM Profile Error: ..."; } 2>&1 | grep -Fav "Killed" leaks the LLVM line; adding | grep -Fav "LLVM Profile Error:" removes it while preserving real lines.
b Root cause explained? Yes. thread_cancel SIGKILLs coverage-instrumented clients mid-insert. On abnormal exit they print LLVM Profile Error: (profraw merge-pool contention, #97020) to stderr. clickhouse-test strips these from a client's stderr, but thread_insert does 2>&1 | grep -Fav "Killed", merging client stderr into stdout with only Killed filtered, so the LLVM lines land in the test's stdout and break the reference diff. The cancellation count (1) was correct.
c Fix matches root cause? Yes. Extends the existing thread_insert output filter to also drop LLVM Profile Error: lines, mirroring clickhouse-test's own documented stderr filter.
d Test intent preserved? Yes. The filter removes only LLVM profiling noise; Killed was already filtered. Real client errors and the 500000/500000/1 output pass through unchanged, so the test still detects a genuine cancellation regression.
e Demonstrated both directions? Fails without fix: 11 master failures (04365) / 8 (02434), all amd_llvm_coverage_per_test, all with LLVM Profile Error: diff pollution (CIDB). Passes with fix: 02434 (identical change, standalone-runnable) produces exactly 500000/500000/1 and matches its reference on a local non-coverage build.
f Fix is general, not narrow? Yes. The identical 2>&1 | grep -Fav "Killed" idiom exists in all three sibling tests (02434, 04365, 04366); all three are fixed.
g Generalizes across inputs? N/A (flaky-test output-filter fix, not a code bug).
h Backward compatible? N/A (test-only change).
i Invariants preserved? N/A (test-only change).

Session id: cron:clickhouse-worker-slot-2:20260716-150500

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @CheSema (cancel-insert test family owner) — test-only fix: the amd_llvm_coverage_per_test recurrence of these three tests is LLVM Profile Error: stderr leaking into stdout via thread_insert's 2>&1, not a cancellation-count race. Extended the output filter to drop those lines (mirrors the #97020 filter clickhouse-test applies to client stderr). Could you take a look?

@PedroTadim PedroTadim added the can be tested Allows running workflows for external contributors label Jul 16, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jul 16, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [ac53c75]

Summary: ❌

job_name test_name status info comment
Stress test (arm_tsan) FAIL
Logical error: Join is supported only for pipelines with one output port, got A and B (STID: 4488-4e11) FAIL cidb
Stress test (amd_tsan) ERROR

AI Review

Summary

This PR extends the shell-side thread_insert filters in the four cancel-insert stateless tests so LLVM Profile Error: lines emitted by SIGKILL'd coverage-instrumented clickhouse-client processes do not leak into stdout and break the reference diff. I re-checked the prior review thread against the current head: the missing 02435 carrier is now covered, and I did not find any remaining correctness or scope gaps in the four affected scripts.

Final Verdict

✅ No actionable findings on the current head.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jul 16, 2026
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger — 63846fb

Every failure below has an owner: a fixing PR, or a full-effort fix task whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt. The fix in this PR (filter LLVM Profile Error: noise from the thread_insert stdout of 02434/04365/04366) held: 04365_cancel_insert_when_client_dies_distributed is OK across every job on this head, zero result-diffs.

Check / test Reason Owner / fixing PR
Stress test (amd_tsan) — "Hung check failed, possible deadlock found" deadlock (chronic; not PR-caused: test-file-only diff cannot deadlock the pipeline executor; same signature on master ~5/day) #108212 (ours, merged) / #105905 (ours, merged)
PR (rollup) reflects the Stress test line above same as above
CH Inc sync — CH Inc sync (private, not actionable by us)

Session id: cron:our-pr-ci-monitor:20260718-080000

02435 shares the defect this PR fixes in the three sibling cancel-insert
tests: its thread_insert merges insert_data stderr into stdout with 2>&1
and filters only Killed/SESSION_IS_LOCKED/SESSION_NOT_FOUND. The TYPE>=3
branch of insert_data runs a native clickhouse-client whose stderr is not
redirected, so when thread_cancel kills a coverage-instrumented client
mid-insert the resulting "LLVM Profile Error:" lines land in the test's
stdout and break the reference diff. clickhouse-test strips those lines
from stderr only, so they survive the 2>&1 merge.

Observed on master, not just latent: 3 failures on
Stateless tests (amd_llvm_coverage_per_test, per_test_coverage, 2/8)
between 2026-06-15 and 2026-07-17, each a "result differs with reference"
whose added lines are exactly the three LLVM Profile Error messages.

Reported by clickhouse-gh[bot] on this PR. A repo-wide sweep of stateless
.sh tests that signal-kill processes and merge output with 2>&1 confirms
these four tests are the complete carrier set.
@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - ac53c75

Every failure below has an owner: a fixing PR, or a full-effort fix task whose
fixing-PR link will be posted here when it opens.

Check / test Reason Owner / fixing PR
Stress test (arm_tsan) / Join is supported only for pipelines with one output port (STID 4488-4e11) Logical error: 'Join is supported only for pipelines with one output port, got 2 and 1' - sharding stream counts diverge #109393 (ours, open)
Stress test (amd_tsan) / (job-level) Code: 209 ... Timeout exceeded while reading from socket (peer: [::1]:9000, 300000 ms) - the stress client's own socket deadline, same underlying event as the arm_tsan row on this head #109393 (ours, open)

Session id: cron:our-pr-ci-monitor:20260729-083000

@groeneai

Copy link
Copy Markdown
Collaborator Author

Superseded by my #113619 (merged 2026-08-29), which strips LLVM Profile Error: from a test's stdout in clickhouse-test itself rather than per test file. Coverage lanes on master, before and after it merged:

test before after
02434_cancel_insert_when_client_dies 13 fail / 8,571 runs 0 / 3,106
02435_rollback_cancelled_queries 2 / 8,563 0 / 3,103
04365_cancel_insert_when_client_dies_distributed 24 / 8,218 0 / 3,106
04366_cancel_insert_when_client_dies_insert_select 0 / 8,221 0 / 3,106

The per-test filters here add nothing on top of that, so this can be closed. Context: #110833 (comment)

@fm4v

fm4v commented Nov 19, 2026

Copy link
Copy Markdown
Member

Closing as obsolete: clickhouse-test now strips LLVM Profile Error: lines from test stdout as well as stderr (#113619), and the per-test coverage lanes set LLVM_PROFILE_FILE=/dev/null (#129684). None of 02434, 02435, 04365, 04366 failed with profile noise in the last 30 days.

@fm4v fm4v closed this Nov 19, 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-testing Test content only (no production code). groeneai-origin-unknown PR origin: unclassified (legacy task) pr-ci

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants