Repository navigation
Fix flaky test_rabbitmq_big_message: keep polling while RabbitMQ consumption progresses - #107813
Conversation
…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]>
|
Workflow [PR], commit [c68cb66] Summary: ✅ AI ReviewSummaryThis 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 Final VerdictStatus: ✅ Approve |
|
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 |
|
@alexbakharew, ok, please remove the unrelated changes. |
pamarcos
left a comment
There was a problem hiding this comment.
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 🙏
511ccee to
c68cb66
Compare
|
@alexey-milovidov @pamarcos done, sorry for delay |
LLVM Coverage Report
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
|
|
Backporting to fix CI |
The integration test
test_storage_rabbitmq/test.py::test_rabbitmq_big_messageis occasionally flaky on the slowest CI configurations (e.g.amd_asan_ubsan, db diskandarm, 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 coststime.sleep(1)plus the time of thecountquery. When the query is not instant — under ASan with the database on a remote S3-backed disk, where each large message becomes its ownMergeTreepart — 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 + timeoutwhenever the row count increases, so the helper waits as long as consumption makes progress and fails only after a genuinetimeout-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):
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
26.6.1.1049