mirror of
https://github.com/bitcoin/bitcoin
synced 2026-12-04 10:50:37 +00:00
zmq: improve handling of invalid configurations #37060
No reviewers
Labels
No labels
Android
Backport
Block storage
Brainstorming
Bug
Build system
CI failed
Consensus
Data corruption
Descriptors
Docs
DrahtBot Guix build requested
Feature
Fuzzing
GUI
Good First Review
IPC
Insufficient Review
Kernel
Linux/Unix
Mempool
Mining
Needs Backport (31.x)
Needs Backport (32.x)
Needs Benchmark
Needs Conceptual Review
Needs backport (30.x)
Needs rebase
Needs release note
Net
P2P
PSBT
Privacy
Private Broadcast
Questions and Help
RPC/REST/ZMQ
Refactoring
Resource usage
Review club
Scripts and tools
Settings
TX fees and policy
Tests
Tracking Issue
UTXO Db and Indexes
Up for grabs
Upstream
Utils/log/libs
Validation
Waiting for author
Wallet
Windows
good first issue
interfaces
macOS
No milestone
No project
No assignees
2 participants
Notifications
Due date
No due date set.
Dependencies
No dependencies set
Reference
bitcoin/bitcoin!37060
Loading…
Reference in a new issue
No description provided.
Delete branch "zmgConfigHandler"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
While messing around with various zmq data ingestion setups for a side project I initially was perplexed because my node kept returning an empty array when I called
bitcoin-cli getzmqnotificationseven though I had 4 zmq emitters configured.Upon closer inspection, it looks like if a single zmq config is invalid / fails to be bound, it prevents all other zmq configurations from being bound. And even worse, the failure occurs silently.
The goal of this PR is to not allow one invalid config to prevent valid configs from working and to make binding failures more obvious in the node logs. Alternatively, if reviewers find it preferable, we could make any zmq bind failure to be a hard error that blocks the node from launching.
Initialize() now attempts every configured notifier, erases only the failed ones, and returns success if at least one remains. Failures are logged:
getzmqnotifications now reports the surviving notifiers instead of returning [].
Added ZMQAddressKey() to canonicalize addresses for socket sharing:
Each notifier now stores its canonical key, Shutdown() uses it, and failed init paths clear psocket after zmq_close() to avoid the previous double-close hazard.
The following sections might be updated with supplementary metadata relevant to reviewers and maintainers.
External sites
Reviews
See the guideline and AI policy for information on the review process.
A summary of reviews will appear here.
Conflicts
Reviewers, this pull request conflicts with the following ones:
If you consider this pull request important, please also help to review the conflicting pull requests. Ideally, start with the one that should be merged first.
🚧 At least one of the CI tasks failed.
Task
iwyu: https://github.com/bitcoin/bitcoin/actions/runs/46936548306/job/143659617167LLM reason (✨ experimental): iwyu_fail: IWYU found required include changes in several files, leaving a diff that caused the check to fail.
Hints
Try to run the tests locally, according to the documentation. However, a CI failure may still
happen due to a number of reasons, for example:
Possibly due to a silent merge conflict (the changes in this pull request being
incompatible with the current code in the target branch). If so, make sure to rebase on the latest
commit of the target branch.
A sanitizer issue, which can only be found by compiling with the sanitizer and running the
affected test.
Intermittent network issues can occur; re-run CI for now, and report the issue if they keep happening.
A functional or integration test failure may be intermittent or unrelated to this pull request.
If no dedicated issue thread exists, create a new one to track it.
Leave a comment here, if you need help tracking down a confusing failure.
🟠 Minor · Scheme-less addresses collide with canonical TCP keys
After a TCP notifier binds, a later notifier configured with the same scheme-less address can silently reuse its socket and appear active without undergoing bind validation.
Location:
src/zmq/zmqutil.cpp:61(head).🔵 Suggestion · Hostname sharing keys are not tied to the bound endpoint
ZMQAddressKeyselects a resolved address, butzmq_bindreceives the original hostname, leaving socket identity dependent on unverified resolver agreement; no actual endpoint mismatch has been established.Location:
src/zmq/zmqutil.cpp:53(head).🔵 Suggestion · New ZMQ tests do not check message delivery
The partial-failure and alias tests check logs and RPC metadata, but would not detect a notifier that remains listed while its shared socket fails to deliver its messages.
Location:
test/functional/interface_zmq.py:596(head).🔵 Suggestion · One commit couples partial initialization with DNS-based sharing
bf5464bdcombines failure isolation with a separate DNS-based socket-sharing policy, making the fix harder to review, backport, or revert independently.Location: src/zmq/zmqutil.cpp:26 (commit).
🔵 Suggestion · The ZMQ startup behavior change lacks a release note
A failed notifier no longer disables every notification, so operators monitoring
getzmqnotificationsfor an empty result need upgrade guidance.Location:
src/zmq/zmqnotificationinterface.cpp:126(head).🔵 Suggestion ·
Cannot parsealso reports hostname-resolution failuresA well-formed
tcp://hostname that cannot resolve is logged as a parse failure, directing operators toward syntax rather than name resolution.Location:
src/zmq/zmqpublishnotifier.cpp:103(head).Review coverage was incomplete.
Reviewed:
bf5464bdc9f2· Review report · Previous reportspermalink