Skip to content

Recreate a hung RabbitMQ container in integration test setup instead of failing the whole module - #114415

Merged
alexey-milovidov merged 1 commit into
masterfrom
rabbitmq-container-start-retry
Aug 12, 2026
Merged

alexey-milovidov merged 1 commit into
masterfrom
rabbitmq-container-start-retry

Conversation

@alexey-milovidov

@alexey-milovidov alexey-milovidov commented Aug 12, 2026 •

Copy link
Copy Markdown
Member

The RabbitMQ container occasionally hangs on startup in integration tests: the entrypoint produces no output at all, the Erlang node never registers with epmd, and rabbitmqctl await_startup keeps failing for the whole 120 seconds — while a parallel worker's container on the same host starts in 3 seconds. When that happens, every test in the affected module fails with Cannot wait RabbitMQ container. This has been striking roughly weekly since at least 2026-06-16, almost always in arm_binary integration jobs, most recently on master: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=e4d3698282346fcd7e496ef668ff517106c84ac5&name_0=MasterCI&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%201%2F4%29&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%201%2F4%29 (21 tests of test_storage_rabbitmq/test_system_stop.py, while test.py in the same run passed all 57 tests with the same image). The host was nearly idle during the hang, so this is not resource starvation.

This change makes wait_rabbitmq_to_start collect diagnostics, force-remove the hung container, bring up a fresh one and wait once more before giving up — the same recovery reset_rabbitmq already uses. Additionally, rabbitmq_debuginfo used to pipe all of its diagnostics output into subprocess.PIPE and never read it, so the failure path collected nothing; it now routes output through run_and_check (which logs it) and also dumps the container state (including the OOM-killed flag) and the in-container process list, so a future hang shows exactly where the entrypoint is stuck.

The behavior is pinned by tests/integration/test_cluster_waiters/test_rabbitmq_start_retry.py (rewritten from test_rabbitmq_diagnostics_once.py, which pinned the structure of the code this change replaces): one set of diagnostics per attempt, one recreation between attempts, recovery when the fresh container comes up, and no effect on the healthy path.

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

...

🤖 Generated with Claude Code

Version info

  • Merged into: 26.8.1.1251 (included in 26.8 and later)

The RabbitMQ container occasionally hangs on startup in CI: the entrypoint
produces no output at all, the Erlang node never registers with epmd, and
`rabbitmqctl await_startup` keeps failing for the whole 120 seconds - while
a parallel worker's container on the same host starts in 3 seconds. When
that happens, every test in the module fails with `Cannot wait RabbitMQ
container`. This has been striking roughly weekly since at least 2026-06-16,
almost always in `arm_binary` integration jobs.

Make `wait_rabbitmq_to_start` collect diagnostics, recreate the container
and wait once more before giving up. Also, `rabbitmq_debuginfo` used to
discard all of its output (piped to stdout and never read); route it through
`run_and_check` so it lands in the test log, and add the container state
and the in-container process list so a future hang shows where the
entrypoint is stuck.

Report: https://s3.amazonaws.com/clickhouse-test-reports/json.html?REF=master&sha=e4d3698282346fcd7e496ef668ff517106c84ac5&name_0=MasterCI&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%201%2F4%29&name_1=Integration%20tests%20%28arm_binary%2C%20distributed%20plan%2C%201%2F4%29

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

clickhouse-gh Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [27ebf5a]

Summary: ✅


AI Review

Summary

This PR changes wait_rabbitmq_to_start to collect diagnostics, recreate a stuck rabbitmq1 container once, and retry startup instead of failing the whole module on the first 120-second miss. The helper change and the rewritten waiter tests line up with that contract, and I did not find a correctness or reliability issue in the current patch.

Final Verdict

✅ No blocking findings.

@clickhouse-gh clickhouse-gh Bot added the pr-ci label Aug 12, 2026
@clickhouse-gh

clickhouse-gh Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 27ebf5a66 with master 86e654b84 (stripped binary size, per-symbol sizes and ThinLTO time; object sizes against the warmup build of ce2fb4e26; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes
Binary Master PR Δ
programs/clickhouse-stripped 691.19 MiB 688.20 MiB -2.99 MiB (-0.43%)

Only the stripped binary is compared: the official master build keeps debug symbols while PR builds strip them, so the other binaries differ by construction.

Compile time of recompiled translation units

6 translation units recompiled, 4 s compile time in total, 6 of them have a recent master baseline.

Job report

@alexey-milovidov alexey-milovidov left a comment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

It's funny how we are still fixing RabbitMQ after five years.

@alexey-milovidov alexey-milovidov self-assigned this Aug 12, 2026
@alexey-milovidov
alexey-milovidov added this pull request to the merge queue Aug 12, 2026
Merged via the queue into master with commit 1bdd9e7 Aug 12, 2026
181 checks passed
@alexey-milovidov
alexey-milovidov deleted the rabbitmq-container-start-retry branch August 12, 2026 15:16
@robot-ch-test-poll3 robot-ch-test-poll3 added the pr-synced-to-cloud The PR is synced to the cloud repo label Aug 12, 2026
pull Bot pushed a commit to sonvt1710/ClickHouse that referenced this pull request Aug 13, 2026
When a RabbitMQ container fails to become available, wait_rabbitmq_to_start
raises and every test in the affected module fails from that one event. The
broker's own log, the artifact that would say why the node never started, does
not survive the run.

rabbitmq.conf sets log.file = /rabbitmq_logs/rabbit.log and no log.console, so
everything the broker logs goes to that file and nothing to the console, which
is also why the docker logs capture produces an empty file. The compose file
declares /rabbitmq_logs as tmpfs, so the log dies with the container.
cluster.py has always exported RABBITMQ_LOGS and RABBITMQ_LOGS_FS="bind" and
created the host directory, but no compose file consumed them after
545bb5b replaced the bind mount with a tmpfs
entry. RabbitMQ was the only broker whose *_LOGS export was dead.

Restore the mount in the same ${VAR_FS:-tmpfs} / ${VAR:-} form the live sibling
compose files use, so an unset RABBITMQ_LOGS still degrades to tmpfs.
/var/lib/rabbitmq stays a tmpfs: it holds Mnesia state, and persisting it
across runs would change test semantics.

The log lands in _instances*/rabbitmq/logs/, which the integration job already
tars.

This neither stops the module abort nor explains why the Erlang node failed to
register with epmd. ClickHouse#114415 recreates a hung container; this makes the next
occurrence diagnosable. ClickHouse#113610 fixed only the second diagnostics loop of
wait_rabbitmq_to_start and is not a container-start fix.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

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.

2 participants