Skip to content

Filter LLVM Profile Error noise from test runner stderr - #102420

Merged
fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-llvm-profile-error-stderr
Apr 11, 2026
Merged

fm4v merged 1 commit into
ClickHouse:masterfrom
groeneai:fix-llvm-profile-error-stderr

Conversation

@groeneai

@groeneai groeneai commented Apr 10, 2026 •

Copy link
Copy Markdown
Collaborator

In coverage builds (amd_llvm_coverage_per_test), short-lived clickhouse-client
processes contend over profraw merge pool files (%2m pattern), producing
LLVM Profile Error: messages on stderr. The test runner treats any non-empty
stderr as a test failure (if stderr: → FAIL), even when the test output is
correct and exit code is 0.

This causes ~1160 false positives per month across 504+ distinct tests on
master coverage runs (CIDB data, 30-day window). Example error:

LLVM Profile Error: Invalid profile data to merge
LLVM Profile Error: Profile Merging of file clickhouse-client-proc0-..._1.profraw failed: Success
LLVM Profile Error: Failed to write file "clickhouse-client-proc0-..._1.profraw": Success

The fix filters lines starting with LLVM Profile Error: from stderr before
the pass/fail decision point. This follows the same pattern as the existing
IGNORED_SANITIZER_ERRORS mechanism for known false positives. Real errors
(exceptions, crashes, Fatal messages) are completely unaffected.

Background: #97020 attempted to fix this via %p in the profraw pattern but was
closed because it creates too many files. #101912 fixed a specific integration
test. This PR addresses the root cause in the test runner itself.

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 to CHANGELOG.md):

  • Not required

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

Version info

  • Merged into: 26.4.1.824

In coverage builds (amd_llvm_coverage_per_test), short-lived
clickhouse-client processes contend over profraw merge pool files,
producing "LLVM Profile Error:" messages on stderr. The test runner
treats any non-empty stderr as a test failure, even when the test
output is correct and exit code is 0.

This causes ~1160 false positives per month across 504+ tests on
master coverage runs.

Filter lines starting with "LLVM Profile Error:" from stderr before
the pass/fail decision, following the same pattern as the existing
IGNORED_SANITIZER_ERRORS mechanism. Real errors (exceptions, crashes,
Fatal messages) are unaffected.

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

Copy link
Copy Markdown
Collaborator Author

Pre-PR Validation (session cron:clickhouse-ci-task-worker:20260410-184500)

a) Deterministic repro? Coverage-build infrastructure issue — LLVM Profile Error is a race condition in profraw file access during concurrent client exits. Cannot reproduce on non-coverage builds. Root cause fully understood from CIDB: 504 tests, 1160 failures in 30d, ALL with LLVM Profile Error: in stderr on amd_llvm_coverage_per_test only.

b) Root cause explained? In coverage builds, clickhouse-client processes inherit LLVM_PROFILE_FILE with %2m merge pool. When multiple short-lived clients exit concurrently, they contend over the same 2 profraw slots → LLVM Profile Error: Invalid profile data to merge / Failed to write file → goes to stderr. Test runner line 2479 (if stderr:) unconditionally marks test as FAIL, even though stdout is correct and exit code is 0.

c) Fix matches root cause? Yes — filters LLVM Profile Error: lines from stderr before the decision point at line 2479. Follows existing IGNORED_SANITIZER_ERRORS pattern. Real errors (exceptions, crashes, Fatal) unaffected.

d) Test intent preserved? No test logic changed. Only infrastructure noise filtered from the test runner.

e) Both directions demonstrated? Unit test of filter logic: pure LLVM errors → empty (passes), real errors preserved, mixed filtering works. Python syntax check passes. Test runner validates correctly on actual tests.

f) Fix is general? Fixes ALL 504 affected tests at once at the test runner level.

CIDB evidence:

SELECT count(DISTINCT test_name) as affected_tests, count() as total_failures
FROM default.checks
WHERE check_name LIKE '%coverage_per_test%'
  AND test_status IN ('FAIL', 'ERROR')
  AND check_start_time > now() - INTERVAL 30 DAY
  AND pull_request_number = 0 AND head_ref = 'master'
  AND test_context_raw LIKE '%LLVM Profile Error%'
-- Result: 504 tests, 1160 failures

@groeneai

Copy link
Copy Markdown
Collaborator Author

cc @fm4v — could you review this? It filters LLVM Profile Error messages from test runner stderr to eliminate ~1160 false positives/month on coverage_per_test runs. You had the most context on this from #97020 and #97029.

@fm4v
fm4v enabled auto-merge April 10, 2026 19:10
@fm4v fm4v self-assigned this Apr 10, 2026
@clickhouse-gh

clickhouse-gh Bot commented Apr 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [e391182]

Summary: ✅


AI Review

Summary

This PR updates tests/clickhouse-test to filter stderr lines beginning with LLVM Profile Error: before pass/fail evaluation, reducing known false-positive failures in coverage jobs while preserving other stderr-based failure signals. Based on the diff and surrounding context, I did not find any blocker or major issue that requires code changes.

ClickHouse Rules
Item Status Notes
Deletion logging ➖
Serialization versioning ➖
Core-area scrutiny ➖
No test removal ✅
Experimental gate ➖
No magic constants ✅
Backward compatibility ➖
SettingsChangesHistory.cpp ➖
PR metadata quality ✅
Safe rollout ✅
Compilation time ✅
No large/binary files ✅
Final Verdict
  • Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Apr 10, 2026
@fm4v fm4v added the can be tested Allows running workflows for external contributors label Apr 10, 2026
@fm4v
fm4v added this pull request to the merge queue Apr 11, 2026
Merged via the queue into ClickHouse:master with commit 151a718 Apr 11, 2026
323 of 324 checks passed
@robot-ch-test-poll4 robot-ch-test-poll4 added the pr-synced-to-cloud The PR is synced to the cloud repo label Apr 11, 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 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