Skip to content

Fix flaky 00906_low_cardinality_cache and 00945_bloom_filter_index on Azure parallel runner - #106667

Closed
groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-flaky-00906-00945-azure
Closed

groeneai wants to merge 1 commit into
ClickHouse:masterfrom
groeneai:groeneai/fix-flaky-00906-00945-azure

Conversation

@groeneai

@groeneai groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator

Both tests intermittently fail on Stateless tests (arm_asan_ubsan, azure, parallel) with MEMORY_LIMIT_EXCEEDED from the global tracker, with Failed 0 out of 3 reruns (transient runner-wide pressure, not per-test bugs). Reported on PR #74691 (alexey-milovidov asked us to fix and send a PR).

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=74691&sha=ae085e998b212b496c9ad6166c2f5dd64625b65c&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20parallel%29

Failure shape (both at 15:39:56 UTC, same run, RSS = 50.39 GiB / 53.69 GiB max):

  • 00906_low_cardinality_cache fails inside AggregatingTransform::consume on the GROUP BY b query (1-row result, but spawns per-thread aggregation state under default max_threads).
  • 00945_bloom_filter_index fails inside MergeTreeSelect on a tiny IN-set lookup. Issue Flaky test: 00945_bloom_filter_index #104873's randomized-settings diagnoser identified the parallel-replicas cluster (enable_parallel_replicas/cluster_for_parallel_replicas/parallel_replicas_for_non_replicated_merge_tree) as the trigger.

Fix: pin the minimum settings to keep these tests light enough to coexist with heavier siblings on shared runners.

  • 00906: max_threads = 1, enable_parallel_replicas = 0 on the GROUP BY. Local measurement: tracked memory drops from 3.16 MiB to 478 KiB (6.6x reduction).
  • 00945: max_threads = 1 and enable_parallel_replicas = 0 at the top. All tables are <= a few hundred rows; single-threaded execution is sufficient to verify bloom-filter index behaviour.

Test intent is preserved in both cases: the LowCardinality cache and bloom filter index assertions are unchanged.

Related: #74691
Related: #104873
Related: #91024

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

...

Documentation entry for user-facing changes

  • Documentation is written (mandatory for new features)

… shared CI runners

Both tests intermittently fail on `Stateless tests (arm_asan_ubsan, azure, parallel)`
with `MEMORY_LIMIT_EXCEEDED` from the global tracker (RSS approaching
`max_server_memory_usage` while the OvercommitTracker cannot free enough memory).
Both tests pass on every rerun, indicating transient runner-wide pressure rather
than a per-test bug.

Diagnosis from the failures (PR ClickHouse#74691, commit `ae085e9`, both at 15:39:56 UTC):

  * `00906_low_cardinality_cache` fails inside `AggregatingTransform::consume`
    on the `GROUP BY b` query, which produces a single row but spawns per-thread
    aggregation state under default `max_threads`.
  * `00945_bloom_filter_index` fails inside `MergeTreeSelect` on a tiny IN-set
    lookup. Issue ClickHouse#104873's randomized-settings diagnoser identified the
    `parallel_replicas`/`enable_parallel_replicas` cluster as the trigger.

Pin the minimum settings to keep these tests light enough to coexist with
heavier siblings on shared runners:

  * `00906`: `max_threads = 1, enable_parallel_replicas = 0` on the GROUP BY.
    Local measurement: tracked memory drops from 3.16 MiB to 478 KiB (6.6x).
  * `00945`: `max_threads = 1` and `enable_parallel_replicas = 0` at the top.
    All tables are <= a few hundred rows; single-threaded execution is enough
    to verify bloom-filter index behaviour.

Test intent is preserved in both cases - the LowCardinality cache and bloom
filter index assertions are unchanged.

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?PR=74691&sha=ae085e998b212b496c9ad6166c2f5dd64625b65c&name_0=PR&name_1=Stateless%20tests%20%28arm_asan_ubsan%2C%20azure%2C%20parallel%29
Related: ClickHouse#74691
Related: ClickHouse#104873
Related: ClickHouse#91024

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

groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

Pre-PR validation gate

# Question Answer
a Deterministic repro? Partial. The CI failure is global-tracker rejection when RSS approaches max_server_memory_usage (50.39 GiB / 53.69 GiB) on the shared runner. I cannot reproduce that runner-wide pressure on a 32 GB local machine. The failures are transient (passed on every rerun in CI), so a single-shot deterministic local repro is not feasible. The mechanism (per-test memory contribution, parallel-replica state amplification) is verifiable locally.
b Root cause explained? Yes. The "(total) memory limit exceeded ... current RSS" comes from MemoryTracker::allocImpl at the Global level after OvercommitTracker::needToStopQuery fails to free enough RSS within its 5s timeout. That happens when many tests run concurrently on Azure ARM ASan and randomization (especially enable_parallel_replicas = 1 per issue #104873's diagnoser) inflates each test's per-query state. The two failing queries in the run (00906_low_cardinality_cache GROUP BY b, 00945_bloom_filter_index query 16) happened to be the ones doing allocations when global pressure peaked.
c Fix matches root cause? Yes. max_threads = 1 directly reduces per-query tracked state by removing per-thread aggregation/reader allocations (measured 6.6x reduction on the 00906 GROUP BY: 3.16 MiB to 478 KiB). enable_parallel_replicas = 0 removes the randomization-driven parallel-replica state amplification that issue #104873's diagnoser identified as the reproducing trigger for 00945. Both settings are at query/test scope, not blanket no-random-* tags.
d Test intent preserved / new tests added? Yes. 00906 still inserts 100M rows and verifies the LowCardinality cache via count() and b. 00945 still verifies bloom-filter index correctness across all data types and table layouts. Neither assertion is weakened. No new tests added because this is not a code bug: it's CI test hygiene to avoid contributing to runner-wide memory pressure.
e Both directions demonstrated? Partial. Cannot reproduce the 50 GiB RSS pressure end-to-end locally. Demonstrated mechanism: with default max_threads, 00906 GROUP BY uses 3.16 MiB tracked memory; with max_threads = 1, 478 KiB. With parallel-replicas randomization simulated via CLI flags (--enable_parallel_replicas=1 --parallel_replicas_local_plan=1 --cluster_for_parallel_replicas=parallel_replicas --parallel_replicas_for_non_replicated_merge_tree=1), both tests pass with the fix.
f Fix is general, not a narrow patch? Yes. Both tests are in this PR: 00906 and 00945 are the two reported on PR #74691. No sibling tests were identified as exhibiting the same failure mode on the same runner. The fix targets the specific tests that the diagnoser and CI logs implicate; it does not silently mask a broader latent bug.

Session id: cron:clickhouse-ci-task-worker:20260607-053000

@groeneai groeneai mentioned this pull request Jun 7, 2026
1 of 21 tasks
@groeneai

groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

cc @CurtizJ — could you review this? It pins max_threads = 1 and enable_parallel_replicas = 0 in two flaky stateless tests (00906_low_cardinality_cache, 00945_bloom_filter_index) so they don't compete for memory with heavier sibling tests on the shared Azure ARM ASan parallel runner.

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

clickhouse-gh Bot commented Jun 7, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [2cfb33a]

Summary: ❌

job_name test_name status info comment
Stress test (arm_ubsan) FAIL
Hung check failed, possible deadlock found FAIL cidb

AI Review

Summary

This PR pins max_threads and enable_parallel_replicas in two flaky stateless tests to reduce runner-wide memory pressure on Stateless tests (arm_asan_ubsan, azure, parallel). The source CI report matches the described MEMORY_LIMIT_EXCEEDED failure shape, and the changed assertions still exercise the existing LowCardinality cache and bloom_filter index behavior. I did not find a correctness or test-contract issue that warrants an inline review comment.

Missing context / blind spots
  • ⚠️ The current PR check report only has Config Workflow and Style check results; broader CI Tests are skipped/pending, so this review did not get a fresh run of the affected Azure ARM ASan parallel stateless job. A targeted CI run of 00906_low_cardinality_cache and 00945_bloom_filter_index under the reported randomized settings would close this gap.
Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Jun 7, 2026
@clickhouse-gh

clickhouse-gh Bot commented Jun 7, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 84.60% 84.50% -0.10%
Functions 92.30% 92.30% +0.00%
Branches 77.20% 77.10% -0.10%

Changed lines: No C/C++ source files changed — skipping uncovered code analysis.

Newly covered by added/modified tests: 359 line(s), 28 function(s) across 126 file(s) · Details

Top files
  • src/Disks/IO/CachedOnDiskWriteBufferFromFile.cpp: 15 line(s)
  • src/Parsers/parseFieldFromCastedLiteral.cpp: 12 line(s), 11 function(s)
  • src/Analyzer/Resolve/QueryAnalyzer.cpp: 10 line(s)
  • src/Functions/FunctionsNumericIndexedVector.h: 10 line(s)
  • src/Storages/ObjectStorageQueue/ObjectStorageQueueSource.cpp: 10 line(s)

Full report

@groeneai

groeneai commented Jun 7, 2026

Copy link
Copy Markdown
Collaborator Author

CI ledger for HEAD 2cfb33abf3c8 (Azure flaky-test fix, 00906_low_cardinality_cache + 00945_bloom_filter_index):

check status classification disposition
All builds, FT, IT, Unit, Performance, ClickBench, Install, Compatibility, Docker, AST/BuzzHouse fuzzer pass clean ---
Stress test (arm_ubsan) "Hung check failed, possible deadlock found" fail chronic / not PR-caused Tracked in our umbrella for the leaked local ThreadPool + GlobalThreadPool shutdown family. 30-day cross-PR: 2 master hits + 16 distinct unrelated PRs. The hung_check stack is in QueryAnalyzer::resolveExpressionNodeList, completely unrelated to the test files this PR pins. PR diff: only the two stateless test files.

The PR-caused failures originally cited on PR #74691 (00906_low_cardinality_cache + 00945_bloom_filter_index OOM under arm_asan_ubsan, azure, parallel) are GREEN on this HEAD with the pinned settings (max_threads = 1, enable_parallel_replicas = 0).

CI fully finished at 2026-06-07 12:19:08Z. Mergeable Check + PR aggregator failures are downstream of the chronic Hung check.

@Algunenano Algunenano left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Another incorrect approach. The query was using 3.16 MiB of memory in a 64GB server. This adjustment does not make any sense. You should investigate the global usage instead, not change specific tiny queries

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

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants