Skip to content

Bump AMQP-CPP from v4.3.18 to v4.3.27 - #119509

Open
actueleai wants to merge 3 commits into
ClickHouse:masterfrom
actueleai:bump-AMQP-CPP-v4.3.27
Open

actueleai wants to merge 3 commits into
ClickHouse:masterfrom
actueleai:bump-AMQP-CPP-v4.3.27

Conversation

@actueleai

@actueleai actueleai commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Fork

Carries the same 10 ClickHouse patches as the old pin, rebased onto v4.3.27; none dropped or adapted.

Bumps the AMQP-CPP fork from v4.3.18 to v4.3.27, keeping RabbitMQ on the pinned fork line and picking up the string_view Channel API and the new connection.blocked/unblocked handler callbacks.

Changelog category (leave one):

  • Build/Testing/Packaging Improvement

Changelog entry (a user-readable short description of the changes that goes into CHANGELOG.md):

Update AMQP-CPP to v4.3.27.


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

Point `contrib/AMQP-CPP` at `ClickHouse/v4.3.27` (`cfd37eb7ce75`), which is
upstream `v4.3.27` with the ClickHouse patch series rebased on top:

- Fix race in `tcp_resolver`
- Update `tcpresolver.h`
- Port to BoringSSL / make it compatible both with OpenSSL and BoringSSL
- Fix RabbitMQ OpenSSL dynamic linking issue
- Fix minor glitch with `TLS_client_method`
- Fix nullptr dereference in `LibUvHandler` callback when connection is lost
- Reject a max frame size of zero proposed by the peer
- Bound the negotiated frame size from above and harden the receive buffer
- Fail close in `receivefrom` when the receive buffer was never allocated

No patch was dropped and none had to be adapted; the previous pin carried the
same series on top of `v4.3.18` plus upstream merge commits.

Notable upstream changes between `v4.3.18` and `v4.3.27`:

- `Channel` and `ChannelImpl` now take `std::string_view` instead of
  `const std::string &` for queue, exchange, routing key and consumer tag
  arguments. The values are copied into `StringField`/frame buffers inside
  the call, and the `ConsumeCallback`/`CancelCallback` signatures still use
  `const std::string &`, so `src/Storages/RabbitMQ` needs no adaptation.
- New `ConnectionHandler::onBlocked` and `ConnectionHandler::onUnblocked`
  callbacks with the corresponding `connection.blocked` /
  `connection.unblocked` frames (new headers `src/connectionblockframe.h`
  and `src/connectionunblockframe.h`).
- `connection.start` now advertises the program and platform name
  (new header-only helpers `src/programname.h` and `src/platformname.h`).

The set of `.cpp` files is unchanged, so `contrib/amqpcpp-cmake/CMakeLists.txt`
needs no update.

Co-Authored-By: Claude Opus 5 <[email protected]>
@thevar1able thevar1able added the can be tested Allows running workflows for external contributors label Sep 11, 2026
@clickhouse-gh

clickhouse-gh Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Workflow [PR], commit [a8c4df4]

Summary: ❌

job_name test_name status info comment
Stress test (arm_debug) FAIL
Received signal 6 (internal) (STID: 1202-2b88) FAIL cidb
Build profile diff ERROR

AI Review

Summary

Updates AMQP-CPP from v4.3.18 to v4.3.27 while preserving the ClickHouse fork patches. ❌ Block: the new pin introduces a reproduced out-of-bounds write during connection setup and enables consumer cancellation without implementing recovery. Reviewed PR head a8c4df47ccb0c9199f78a3185e67c1c979fc34e8.

Findings

❌ Blockers

  1. Failed executable-name lookup writes outside its buffer. contrib/AMQP-CPP:1 imports src/programname.h:72, where a failed readlink leaves size = -1 but the constructor still writes _path[-1]. ConnectionStartFrame::process constructs this helper on every connection. This is reachable on macOS, which lacks /proc/self/exe, and Linux environments where that path is unavailable. A focused reproduction using the exact header and an interposed failing readlink exited with status 1 under UBSan: index -1 out of bounds for type 'char [4096]'. Patch the fork to handle the negative return before indexing, then update the pin.

  2. Consumer cancellation bypasses RabbitMQ ingestion recovery. contrib/AMQP-CPP:1, existing unresolved finding. The new pin advertises consumer_cancel_notify; on RabbitMQ 4.3, quorum-queue acknowledgement timeouts consequently send basic.cancel instead of the channel error received with the old pin. This behavior is documented in the RabbitMQ 4.3 release notes and verified in the broker source. ChannelImpl::reportCancelled removes the consumer, but RabbitMQConsumer::subscribe registers no onCancelled callback. Its state stays OK, needChannelUpdate stays false, and ingestion can remain stopped after the backlog drains despite a healthy connection. Add a generation-aware cancellation handler that logs and triggers channel recovery, or disable the advertised capability until it is handled.

Tests
  • ⚠️ Add a focused regression proving ingestion resumes after broker-initiated basic.cancel, preferably a quorum-queue consumer timeout on RabbitMQ 4.3. The existing integration fixture pins RabbitMQ 4.2.1, whose timeout behavior does not exercise this capability-dependent change. This integration scenario was not run locally.
  • ⚠️ Verify the fork fix with a failing readlink under UBSan; the current-header reproduction demonstrates the defect but provides no committed regression coverage.
Final Verdict

Status: ❌ Block. Guard the executable-name lookup failure, implement or disable consumer-cancellation notification, and cover both failure paths before merging.

@clickhouse-gh clickhouse-gh Bot added pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR. comp-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. labels Sep 11, 2026
Comment thread contrib/AMQP-CPP
@@ -1 +1 @@
Subproject commit 4fccd7f84318fe3a022c63a5b621a831c99e3a32
Subproject commit cfd37eb7ce75aff8901f14b41768f21b24b3674f

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This bump changes consumer-cancel behavior in a way ClickHouse does not currently handle. In AMQP-CPP v4.3.27 the client now advertises consumer_cancel_notify in src/connectionstartframe.h, and broker-side basic.cancel frames are routed through src/basiccancelframe.h / src/channelimpl.cpp to DeferredConsumer::onCancelled. But src/Storages/RabbitMQ/RabbitMQConsumer.cpp only installs onSuccess, onReceived, and onError handlers.

That means a queue deletion or temporary queue unavailability no longer has to surface as a channel error: AMQP-CPP can just remove the consumer from its map and invoke onCancelled. Because ClickHouse never registers that callback, state stays OK, needChannelUpdate() stays false, and the source quietly stops consuming until the connection is recreated. With a single queue/consumer table this stalls ingestion completely.

Please either keep consumer_cancel_notify disabled in the fork for now, or teach RabbitMQConsumer::subscribe() to handle onCancelled the same way as onError (log it and switch to State::ERROR) and cover that with a RabbitMQ integration test that removes or makes the queue unavailable after startup.

@clickhouse-gh

clickhouse-gh Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Build profile diff (arm_release)

Comparing commit a8c4df47ccb0c9199f78a3185e67c1c979fc34e8 with master failed: LogClusterNotReady: the endpoint never became ready.

See the job log for details.

@clickhouse-gh clickhouse-gh Bot added the manual approve Manual approve required to run CI label Oct 12, 2026
Comment thread contrib/AMQP-CPP
@@ -1 +1 @@
Subproject commit 4fccd7f84318fe3a022c63a5b621a831c99e3a32
Subproject commit cfd37eb7ce75aff8901f14b41768f21b24b3674f

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

[P1] Guard failed executable-name lookup before writing the terminator

The new pin introduces src/programname.h, and ConnectionStartFrame::process constructs ProgramName for both product and connection_name on every connection. If readlink fails, size is -1, but line 72 still executes _path[size == PATH_MAX ? PATH_MAX-1 : size] = '\0', writing to _path[-1]. Setting _valid to false does not guard this write.

This happens on macOS, where /proc/self/exe is absent and the RabbitMQ engine remains enabled, and can also happen on Linux when that procfs path is unavailable. A focused reproduction against this exact header, with readlink returning -1 and -fsanitize=undefined -fno-sanitize-recover=all, exits with programname.h:72:51: runtime error: index -1 out of bounds for type 'char [4096]'.

Please patch the fork to handle a negative return before indexing _path, then update the pin. Otherwise normal RabbitMQ connection setup introduces undefined behavior on these systems.

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-external-dependencies Third-party deps updates in contrib/, vendored code, and platform base libraries. manual approve Manual approve required to run CI pr-build Pull request with build/testing/packaging improvement submodule changed At least one submodule changed in this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants