Skip to content

Point LLVM_PROFILE_FILE at /dev/null on the per-test coverage lanes - #129684

Merged
alexbakharew merged 1 commit into
ClickHouse:masterfrom
groeneai:per-test-coverage-no-llvm-profile
Nov 6, 2026
Merged

alexbakharew merged 1 commit into
ClickHouse:masterfrom
groeneai:per-test-coverage-no-llvm-profile

Conversation

@groeneai

@groeneai groeneai commented Nov 6, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #118370
Related: #110716

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

Stateless tests (amd_llvm_coverage_per_test, per_test_coverage, 2/8) on master 358b8300 lost 251 results: from 02435_rollback_cancelled_queries on, client processes printed the right output and then died with return code: 139 (SIGSEGV).

On the per-test coverage lanes every process merges its counters at exit into a merge-pool file shared by the whole job (%2m / %4m without continuous mode; #118370 dropped %c for clients), rewriting the file in place. A process SIGKILLed during that rewrite (02435's thread_cancel, the runner's kill on a timeout) can leave the value-profile records cut inside a record. Every later process mapped to that pool slot then crashes in lprofMergeValueProfData at exit. In the job log all 392 crashing client PIDs are even (pool slot 0), and the 163 sequential tests, which use another pool file, all passed.

These lanes never merge a .profraw (their coverage comes from system.coverage_log), so this PR sets LLVM_PROFILE_FILE=/dev/null there for the clickhouse-test clients, the job environment in functional_tests.py (servers, job clients, coverage export), and the containers and host clients of per-test integration jobs. Other lanes keep their %c values.

Validation with the CI binary of the failing run:

  • A pool file cut inside its value-profile data: 46 of 64 cut points give the CI signature (output, then SIGSEGV in lprofMergeValueProfData).
  • clickhouse-test --collect-per-test-coverage over tests that failed in CI with such pool files: the 11 parallel ones fail with return code: 139 before, all 12 pass after; 02435_rollback_cancelled_queries passes and no profile file is written.
  • Per-test integration run of test_materialized_view_restart_server: passes, no it-*.profraw, same per-module coverage.

#110716 filters the LLVM Profile Error: Invalid profile data to merge noise of the same kill; with this change it cannot occur on this lane.

🤖 Generated with Claude Code


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

Version info

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

On the per-test coverage lanes every process of the coverage binary merged
its counters at exit into a merge-pool file shared by the whole job (`%2m`
for stateless clients and the job env, `%4m` for integration containers and
host clients), without continuous mode. The exit-time merge maps the pool
file, merges it, truncates it and rewrites it from offset 0. A process
SIGKILLed during that rewrite (02435's `thread_cancel`, the runner's
process-group kill on a timeout) can leave the value-profile records cut
inside a record. Every later process whose pool slot (`getpid() % N`) is
that file then reads past the mapping in `lprofMergeValueProfData` and dies
with SIGSEGV after its output, and the file stays poisoned. NightlyCoverage
`Stateless tests (amd_llvm_coverage_per_test, per_test_coverage, 2/8)` on
358b830 lost 251 results this way: all 392 crashing client PIDs were even
(pool slot 0), and the 163 sequential tests, which use another pool file,
all passed.

Those lanes never merge a `.profraw`: per-test coverage is read inside the
server from the static counter section and exported from
`system.coverage_log`. So point `LLVM_PROFILE_FILE` at `/dev/null` there:
no process opens, reads or merges a pool file any more. The other lanes keep
their `%c` values, which never merge. Not `%p` (thousands of files, ClickHouse#97020),
not `%c` again (the shared-mapping slowdown ClickHouse#118370 removed).

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

groeneai commented Nov 6, 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; 1 finding on the first pass, 0 on the re-run after the title fix) plus my own review (2 nits).

# Sev Finding Verdict Evidence / action
1 ⚠️ The title promised that the per-test lanes write no LLVM profile, but clickhouse --version in integration_test_job.py, the integration coverage exporter (export-%m), test_git_import (%p) and test_server_reload (empty value) still write one AGREE (title) Title narrowed to the change itself. None of these paths merges into a pool file that a killable process rewrites: three have no %m, and the exporter's own pool is used only by its sequential, never-killed processes at the end of the job. No code change.
2 💡 Without %m, __llvm_profile_dump() on the server's forced-shutdown paths prints one LLVM Profile Warning line to stderr AGREE, noted No check on these lanes reads that stderr (CHECK_ERRORS is skipped for per-test coverage; integration reads it only for sanitizer reports).
3 💡 Description precision: #118370 dropped %c only for clients AGREE, fixed in the description none

Severity: ❌ blocker / ⚠️ major / 💡 nit.

Session id: cron:clickhouse-review-slot-8:20261106-062800

@groeneai

groeneai commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator Author

cc @alexbakharew, could you review this and add the can be tested label so CI runs? On the per-test coverage lanes every process merges its profile at exit into a shared %2m/%4m pool file, so a client SIGKILLed mid-merge poisons that file and every later client on the same slot segfaults at exit (251 lost results on master); these lanes never read a .profraw, so this sets LLVM_PROFILE_FILE=/dev/null there and leaves the %c lanes unchanged.

@clickhouse-gh

clickhouse-gh Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [71cfee3]

Summary: ✅


AI Review

Summary

Reviewed #129684 at 71cfee33237250ba31d4ec48bfd790ca1ecb032e, including all prior discussion and the surrounding coverage collection, client, restart, and export paths. The change directs per-test coverage processes to /dev/null, preventing interrupted profile merges from poisoning subsequent processes. No actionable findings.

Missing context / blind spots
  • ⚠️ The coverage-specific lanes run in NightlyCoverage and were not rerun during this review. Runtime validation relies on the PR's documented corrupted-profile A/B reproductions and integration restart test; a patched nightly run would complete end-to-end confirmation.
Final Verdict

✅ Approve. No changes requested.

@clickhouse-gh clickhouse-gh Bot added pr-ci can be tested Allows running workflows for external contributors comp-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). labels Nov 6, 2026
@alexbakharew
alexbakharew added this pull request to the merge queue Nov 6, 2026
Merged via the queue into ClickHouse:master with commit c162649 Nov 6, 2026
367 of 368 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 6, 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-ci-infrastructure CI/CD pipelines (GitHub Actions, CI scripts, runners). 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