Skip to content

Fix flaky test_rabbitmq_big_message: keep polling while RabbitMQ consumption progresses - #107813

Merged
alexey-milovidov merged 2 commits into
masterfrom
fix-rabbitmq-big-message-flaky-polling
Jun 19, 2026
Merged

alexey-milovidov merged 2 commits into
masterfrom
fix-rabbitmq-big-message-flaky-polling

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Jun 18, 2026 •

Copy link
Copy Markdown
Member

The integration test test_storage_rabbitmq/test.py::test_rabbitmq_big_message is occasionally flaky on the slowest CI configurations (e.g. amd_asan_ubsan, db disk and arm, distributed plan).

The root cause is the shared helper check_expected_result_polling. It is meant to fail only when consumption from RabbitMQ stalls — both its comment ("extend the deadline") and its failure message ("without any RabbitMQ consumption") say so. But it extended the deadline by only one second per iteration (deadline += 1), while each iteration costs time.sleep(1) plus the time of the count query. When the query is not instant — under ASan with the database on a remote S3-backed disk, where each large message becomes its own MergeTree part — the deadline cannot keep pace and the helper abandons a test that is still steadily consuming.

In the analyzed failing run the materialized view had already received 822000 of the 1000000 expected rows and was still gaining ~38000 rows every 10 seconds when the helper gave up. A virtual-clock simulation of that consumption profile reproduces the failure: at a per-query time of ~0.7s the old logic stops at ~831800 rows (matching the observed 822000), while the new logic always completes.

Fix: reset the no-progress deadline to now + timeout whenever the row count increases, so the helper waits as long as consumption makes progress and fails only after a genuine timeout-long stall. This matches the documented intent and hardens all callers of the helper, not just this test.

The test passes locally (1 passed in 23.44s).

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=905ae608d34fe609530e5d514c8eee3b0a3f60a4&name_0=MasterCI&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%206%2F6%29

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

Not for changelog (CI fix).

🤖 Generated with Claude Code

Version info

  • Merged into: 26.6.1.1049

…rogresses

`check_expected_result_polling` is meant to fail only when consumption from
RabbitMQ stalls — both its comment ("extend the deadline") and its failure
message ("without any RabbitMQ consumption") say so. But the implementation
extended the deadline by only one second per iteration (`deadline += 1`),
while each iteration costs `time.sleep(1)` plus the time of the `count` query.
When the query is not instant (e.g. under ASan with the database on a remote
S3-backed disk, where every large message becomes its own `MergeTree` part),
the deadline cannot keep pace and the helper abandons a test that is still
steadily consuming.

In the failing run the materialized view had already received 822000 of the
1000000 expected rows and was still gaining ~38000 rows every 10 seconds when
the helper gave up. A virtual-clock simulation of that profile reproduces the
failure: at a per-query time of ~0.7s the old logic stops at ~831800 rows
(matching the observed 822000), while the new logic always completes.

Fix: reset the no-progress deadline to `now + timeout` whenever the row count
increases, so the helper waits as long as consumption makes progress and fails
only after a genuine `timeout`-long stall. This matches the documented intent
and makes all callers of the helper robust to slow-but-steady consumption.

The test passes locally (`1 passed in 23.44s`).

CI report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=905ae608d34fe609530e5d514c8eee3b0a3f60a4&name_0=MasterCI&name_1=Integration%20tests%20%28amd_asan_ubsan%2C%20db%20disk%2C%20old%20analyzer%2C%206%2F6%29

Co-Authored-By: Claude Opus 4.8 (1M context) <[email protected]>
@clickhouse-gh

clickhouse-gh Bot commented Jun 18, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [c68cb66]

Summary: ✅


AI Review

Summary

This PR changes the shared RabbitMQ integration-test polling helper so the timeout measures lack of row-count progress rather than total elapsed time. The implementation matches the stated helper contract and the current callers use it for finite, monotonic count() checks over destination tables, so I do not see a blocking issue.

Final Verdict

Status: ✅ Approve

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

Copy link
Copy Markdown
Contributor

I will do some small experiment with LLVM coverage. I want to prove one method of stabilizing the numbers. I will remove all unrelated changes later today

Comment thread ci/jobs/llvm_coverage_job.py Resolved
@alexey-milovidov

Copy link
Copy Markdown
Member Author

@alexbakharew, ok, please remove the unrelated changes.

@pamarcos pamarcos self-assigned this Jun 19, 2026

@pamarcos pamarcos 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.

Thanks for tackling this. The changes in the test are 👌
@alexbakharew I don't want to undo your commit, so once your test is finished, revert it so that we can merge this 🙏

@alexbakharew
alexbakharew force-pushed the fix-rabbitmq-big-message-flaky-polling branch from 511ccee to c68cb66 Compare June 19, 2026 11:59
@alexbakharew

Copy link
Copy Markdown
Contributor

@alexey-milovidov @pamarcos done, sorry for delay

@pamarcos
pamarcos enabled auto-merge June 19, 2026 12:02
@clickhouse-gh

clickhouse-gh Bot commented Jun 19, 2026

Copy link
Copy Markdown
Contributor

LLVM Coverage Report

Metric Baseline Current Δ
Lines 85.30% 85.20% -0.10%
Functions 92.60% 92.50% -0.10%
Branches 77.50% 77.40% -0.10%

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

Newly covered by added/modified tests: 358 line(s), 19 function(s) across 122 file(s) · Details

Top files
  • src/Databases/DataLake/HiveCatalog.cpp: 31 line(s), 3 function(s)
  • src/Server/DistributedQuery/StreamingExchangeSink.cpp: 16 line(s), 1 function(s)
  • src/AggregateFunctions/AggregateFunctionQuantileGK.cpp: 15 line(s)
  • src/Storages/StorageReplicatedMergeTree.cpp: 13 line(s)
  • src/Parsers/parseFieldFromCastedLiteral.cpp: 12 line(s), 11 function(s)

Full report

@alexey-milovidov
alexey-milovidov merged commit a993707 into master Jun 19, 2026
165 of 166 checks passed
@alexey-milovidov
alexey-milovidov deleted the fix-rabbitmq-big-message-flaky-polling branch June 19, 2026 17:09
@robot-clickhouse robot-clickhouse added the pr-synced-to-cloud The PR is synced to the cloud repo label Jun 19, 2026
@PedroTadim

Copy link
Copy Markdown
Member

Backporting to fix CI

@robot-clickhouse robot-clickhouse added the pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR label Sep 15, 2026
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore label Sep 15, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

pr-backports-created Backport PRs are successfully created, it won't be processed by CI script anymore pr-ci pr-must-backport-synced The `*-must-backport` labels are synced into the cloud Sync PR pr-synced-to-cloud The PR is synced to the cloud repo v26.3-must-backport

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants