Skip to content

Make test_rabbitmq_default_mode_nack_on_parse_error detect a consumer channel wedged by basic.nack - #130649

Open
groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:rabbitmq-basicnack-not-synchronous
Open

groeneai wants to merge 2 commits into
ClickHouse:masterfrom
groeneai:rabbitmq-basicnack-not-synchronous

Conversation

@groeneai

@groeneai groeneai commented Nov 10, 2026 •

Copy link
Copy Markdown
Collaborator

Related: #130541
Related: ClickHouse/AMQP-CPP#9

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

Description

The basic.nack fix this PR was opened for (ClickHouse/AMQP-CPP#9) reached master through #130541, which moved contrib/AMQP-CPP to the same commit 5f4c447. This PR no longer changes the pin; only the test change is left.

test_rabbitmq_default_mode_nack_on_parse_error asserted at least one dead letter, and that also passes when the consumer channel is wedged: the first basic.nack is written to the socket before the channel marks itself synchronous, and only the frames after it are never sent. The test now waits for two dead letters. With the pin from before #130541 (4fccd7f) it gets exactly one and fails (assert 1 >= 2); with 5f4c447 it passes (20/20 local runs).

This guards later bumps of the submodule: the open #119509 moves the pin to cfd37eb, whose src/basicnackframe.h has no synchronous() override, the same state as 4fccd7f.

🤖 Generated with Claude Code


Workflow [PR]
Sync PR [sync-upstream/pr/130649]

… channel

Move contrib/AMQP-CPP from 4fccd7f to 5f4c447, the merge commit of
ClickHouse/AMQP-CPP#9 on the fork's master.

In AMQP-CPP, MethodFrame::synchronous() returns true and every asynchronous
method frame a channel sends overrides it to false. BasicNackFrame did not,
although AMQP 0-9-1 has no basic.nack-ok. ChannelImpl::send() therefore set the
channel's _synchronous flag after a nack, and from then on every frame was
queued locally instead of written to the socket, while send() kept reporting
success.

RabbitMQConsumer::nackMessages() sends the cumulative nack with
AMQP::multiple whenever a batch fails to be pushed to the views (or consumption
is aborted). After that the consumer's basic.ack frames, later rejects and the
channel close were never transmitted: rows were inserted but stayed unacked on
the broker, so they are delivered again after a reconnect.

The new pin also contains ClickHouse/AMQP-CPP#11
(a nesting-depth limit for decoded field tables and arrays, src/field.cpp),
which is the commit ClickHouse#130541 moves to.

test_rabbitmq_default_mode_nack_on_parse_error now waits for two dead letters
instead of one. In the test's default error mode each streaming iteration stops
at the first message that fails to parse and nacks it with a cumulative
basic.nack. ChannelImpl::send() writes a frame before it sets the flag, so the
first nack always reaches the broker, and with the old pin every later one is
queued and never sent. With the old pin the test gets exactly one dead letter
and fails.

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

Copy link
Copy Markdown
Collaborator Author
Internal second-model review
Finding Verdict
⚠️ Commit message explained the first dead letter by a per-tag reject loop that does not run in the test's default error mode Agreed, message amended (tree unchanged)
⚠️ Bundled AMQP-CPP#11 nesting limit has no regression test here Not in this PR: #11 belongs to its own bump (#130541) and only rides along because the pin is the fork commit as merged
💡 Changelog entry overstated "stopped sending anything" (the producer is unaffected) Reworded

Final re-review of the amended commit: no findings.

@groeneai

Copy link
Copy Markdown
Collaborator Author
Pre-PR validation gate (click to expand)
# Question Answer
a Deterministic repro? Yes. On current master (pin 4fccd7f) the tightened test_rabbitmq_default_mode_nack_on_parse_error fails every run with assert 1 >= 2. Not a rate.
b Root cause explained? Yes. BasicNackFrame inherited MethodFrame::synchronous() == true, but basic.nack has no -ok reply, so after the cumulative nack in RabbitMQConsumer::nackMessages the channel stays in synchronous state and every later frame (acks, rejects, close) is queued locally while send() reports success.
c Fix matches root cause? Yes. The missing override was merged into the fork as ClickHouse/AMQP-CPP#9; this PR moves contrib/AMQP-CPP to that merge commit. No ClickHouse-side workaround.
d Test intent preserved / new tests added? Yes. The existing test keeps its fixture and assertions; only the dead-letter threshold rises from 1 to 2, which makes it fail on a wedged channel.
e Both directions demonstrated? Yes. Master binary: fails (assert 1 >= 2). This PR: 20/20 passes. Build IDs checked in the server start lines.
f Fix is general across code paths? Yes. Among the client-sent frames, basic.nack is the only method frame with no -ok reply that did not override synchronous(). Both nack callers (failed push to views, aborted consumption with requeue) send the same frame.
g Fix generalizes across inputs (params/datatypes/wrappers)? Yes. synchronous() takes no input; requeue true/false and multiple build the same frame type.
h Backward compatible? (maintainer-approved exception only) Yes. No setting or format change. The new pin also contains ClickHouse/AMQP-CPP#11 (a 64-level nesting limit for decoded field tables); test_rabbitmq_malicious_broker passes 6/6 with it.
i Invariants and contracts preserved? Yes. A const predicate restored to the library's own convention; frames that used to be queued forever are now sent. test_storage_rabbitmq/ sweep: 82 passed, 4 skipped; the 2 local failures fail the same way on the master binary and pass in master CI.

Session id: cron:clickhouse-impl-slot-4:20261110-213900

@clickhouse-gh

clickhouse-gh Bot commented Nov 10, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [26ae582]

Summary: ✅


AI Review

Summary

The current diff strengthens test_rabbitmq_default_mode_nack_on_parse_error by requiring two dead letters, detecting a consumer channel that stops transmitting after its first basic.nack. The library fix is already on master through #130541. No actionable findings: the assertion matches the single-consumer parse-error path, preserves the subsequent successful-ingestion check, and has a passing ARM CI result from the earlier revision with the same test change. The author also records failure with the old library pin and 20 successful runs with the fixed pin. Integration tests were not rerun locally.

Final Verdict

Status: ✅ Approve

@clickhouse-gh clickhouse-gh Bot added pr-bugfix Pull request with bugfix, not backported by default submodule changed At least one submodule changed in this PR. can be tested Allows running workflows for external contributors comp-message-queues Message queue integrations (Kafka, RabbitMQ, NATS table engines for stream ingestion/egress). labels Nov 10, 2026
@clickhouse-gh

clickhouse-gh Bot commented Nov 11, 2026

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing 2a20025b2 with master b8c902a6c (stripped binary size, per-symbol sizes and ThinLTO time; compile times per translation unit against the most recent warmup build that recompiled it).

✅ No significant changes.

Binary sizes

programs/clickhouse-stripped: smaller than the master baseline by the known offset between the two builds, so the difference is not shown. A delta that differs from the offset by more than 50% of it is shown, in either direction.

The official master build is compiled with -g and a pull request build is not, and XRay counts debug instructions towards its instrumentation threshold, so master instruments thousands of functions more and its binary is ~0.4% larger no matter what the pull request does.

Slowest function optimization changes (ThinLTO)

Median per-function time ratio to the master baseline: programs/clickhouse-keeper ×1.09 (each binary is linked separately, on a different machine and with different build flags); deltas below are relative to it.

Binary Function Master PR Δ vs median
programs/clickhouse DB::registerFunctionConversion(DB::FunctionFactory&) 8.6 s 17.7 s +9.4 s (+115%)
Compile time of recompiled translation units

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

Job report

@groeneai

Copy link
Copy Markdown
Collaborator Author

CI finish ledger - 2a20025

Every failure below has an owner: a fixing PR (mine or external), or a full-effort fix task
whose fixing-PR link will be posted here when it opens. Only CH Inc sync is exempt.

Check / test Reason Owner / fixing PR
Stress test (amd_tsan) / Segmentation fault (STID: 2830-4b5d) crash, not from this PR (it only updates contrib/AMQP-CPP and the RabbitMQ integration test): SIGSEGV in KeyCondition::KeyCondition on a merge() child read planned for INSERT ... RETURNING. This tree already contains the fix for this stack (#127919), so this is a variant it does not cover a fix task is created (investigating at full effort, fixing-PR link to follow here)
Integration tests (arm_binary, 4/4) / (no test row) infra, not attributable to this PR: the runner lost communication with the server during Run after 109 minutes (GitHub annotation), with no log and no CIDB row. It was not retried (the run was already at attempt 3). Shards 1/4 to 3/4 passed in 79 to 95 minutes, and the test_storage_rabbitmq tests ran and passed in shard 2/4 and in the targeted and flaky-check jobs a fix task is created (fixing-PR link to follow here)
Mergeable Check, PR praktika rollups of the rows above the fix tasks above (a fix task is created)

Fast test, Style check and both Bugfix validation (integration tests, *) jobs passed. The Config Workflow / Pre Hooks and Finish Workflow / Post Hooks failures on this head come from attempts 1 and 2, which stopped at the can be tested label; attempt 3 ran the full CI. CIDB has no other FAIL or ERROR row on this head.

Session id: cron:our-pr-ci-monitor:20261111-033007

@groeneai

groeneai commented Nov 11, 2026 •

Copy link
Copy Markdown
Collaborator Author

Fixing PR for the Stress test (amd_tsan) STID 2830-4b5d crash: #125990 (mine, open).

The merge() child that crashed is a TimeSeries table. fatal.log has INSERT INTO test_c8f2t2c7x8j4.`.inner_id.metricfamilies.<uuid>` (metric_family) RETURNING (SELECT count() FROM merge(currentDatabase(), '.*')) ..., and the INSERT target is one of that table's targets. StorageTimeSeries::readImpl plans SQL over its targets in a nested analysis that still has the inserted block as the view source, so on master the target is typed by the block's key-less metadata while the MergeTree itself is read. #125990 gives the block's types only to the analysis that swaps the block in, so this nested read uses the table's own metadata.

…d it

ClickHouse#130541 moved contrib/AMQP-CPP to 5f4c447 on master (commit 8d85c7f), the
same commit this PR moved it to, so the basic.nack fix no longer needs this
PR. Set the gitlink back to the value of this branch's merge base (4fccd7f):
the PR then changes only test_rabbitmq_default_mode_nack_on_parse_error, and
merging it keeps master's 5f4c447.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
@groeneai groeneai changed the title Update AMQP-CPP to fix a RabbitMQ consumer that stops acknowledging messages after a nack Make test_rabbitmq_default_mode_nack_on_parse_error detect a consumer channel wedged by basic.nack Nov 22, 2026
@clickhouse-gh clickhouse-gh Bot added pr-ci and removed pr-bugfix Pull request with bugfix, not backported by default labels Nov 22, 2026

This branch has not been deployed

No deployments
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 comp-message-queues Message queue integrations (Kafka, RabbitMQ, NATS table engines for stream ingestion/egress). pr-ci submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant