Failure to bind to ZMQ addresses is swallowed in debug logs #33715

issue torkelrogstad openend this issue on October 27, 2025
  1. torkelrogstad commented at 5:16 pm on October 27, 2025: contributor

    Is there an existing issue for this?

    • I have searched the existing issues

    Current behaviour

    When failing to bind to specified ZMQ addresses due to them already being in use, the error is completely swallowed up when not running with debug logs.

    Expected behaviour

    I’d expect one of two things to happen:

    1. Bitcoin Core exiting with a non-zero status code and a clear message saying what happened (I’d prefer this)
    2. An error message in the logs, that is visible without having to enable debug logs.

    Steps to reproduce

    1. Spawn a node with one of the ZMQ arguments provided: bitcoind -regtest -noconf -datadir=(mktemp -d) -rpcuser=user -rpcpassword=password -rpcport=18888 -port=17777 -zmqpubrawblock=tcp://localhost:10000
    2. Spawn a second node with the same ZMQ argument(s): bitcoind -regtest -noconf -datadir=(mktemp -d) -rpcuser=user -rpcpassword=password -rpcport=18889 -port=17778 -zmqpubrawblock=tcp://localhost:10000
    3. Observe that both nodes run just fine, but that just the first one is able to bind to the ZMQ address:
       0❯ bitcoin-cli -rpcport=18888 -rpcuser=user -rpcpassword=password getzmqnotifications
       1[
       2   {
       3     "type": "pubrawblock",
       4     "address": "tcp://localhost:10000",
       5     "hwm": 1000
       6   }
       7 ]
       8
       9 ❯ bitcoin-cli -rpcport=18889 -rpcuser=user -rpcpassword=password getzmqnotifications
      10 [
      11 ]
      
    4. Observe that no clear warnings/errors are produced from the second node.

    Relevant log output

    ❯ bitcoind -regtest -noconf -datadir=(mktemp -d) -rpcuser=user -rpcpassword=password -rpcport=18889 -port=17778 -zmqpubrawblock=tcp://localhost:10000 2025-10-27T17:10:29Z Bitcoin Core version v29.0.0 (release build) 2025-10-27T17:10:29Z Using the ‘arm_shani(1way,2way)’ SHA256 implementation 2025-10-27T17:10:29Z Default data directory /Users/torkel/Library/Application Support/Bitcoin 2025-10-27T17:10:29Z Using data directory /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest 2025-10-27T17:10:29Z Config file: 2025-10-27T17:10:29Z Command-line arg: conf=false 2025-10-27T17:10:29Z Command-line arg: datadir="/var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy" 2025-10-27T17:10:29Z Command-line arg: port=“17778” 2025-10-27T17:10:29Z Command-line arg: regtest="" 2025-10-27T17:10:29Z Command-line arg: rpcpassword=**** 2025-10-27T17:10:29Z Command-line arg: rpcport=“18889” 2025-10-27T17:10:29Z Command-line arg: rpcuser=**** 2025-10-27T17:10:29Z Command-line arg: zmqpubrawblock=“tcp://localhost:10000” 2025-10-27T17:10:29Z Using at most 125 automatic connections (285 file descriptors available) 2025-10-27T17:10:29Z scheduler thread start 2025-10-27T17:10:29Z Binding RPC on address ::1 port 18889 2025-10-27T17:10:29Z Binding RPC on address 127.0.0.1 port 18889 2025-10-27T17:10:29Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation. 2025-10-27T17:10:29Z Starting HTTP server with 16 worker threads 2025-10-27T17:10:29Z Using wallet directory /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/wallets 2025-10-27T17:10:29Z init message: Verifying wallet(s)… 2025-10-27T17:10:29Z Using /16 prefix for IP bucketing 2025-10-27T17:10:29Z init message: Loading P2P addresses… 2025-10-27T17:10:29Z Creating peers.dat because the file was not found ("/var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/peers.dat") 2025-10-27T17:10:29Z init message: Loading banlist… 2025-10-27T17:10:29Z Recreating the banlist database 2025-10-27T17:10:29Z SetNetworkActive: true 2025-10-27T17:10:29Z /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/fee_estimates.dat is not found. Continue anyway. 2025-10-27T17:10:29Z Cache configuration: 2025-10-27T17:10:29Z * Using 2.0 MiB for block index database 2025-10-27T17:10:29Z * Using 8.0 MiB for chain state database 2025-10-27T17:10:29Z * Using 440.0 MiB for in-memory UTXO set (plus up to 286.1 MiB of unused mempool space) 2025-10-27T17:10:29Z Script verification uses 11 additional threads 2025-10-27T17:10:29Z Using obfuscation key for blocksdir *.dat files (/var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/blocks): ’e386ebca6b3ba7e8’ 2025-10-27T17:10:29Z Opening LevelDB in /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/blocks/index 2025-10-27T17:10:29Z Opened LevelDB successfully 2025-10-27T17:10:29Z Using obfuscation key for /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/blocks/index: 0000000000000000 2025-10-27T17:10:29Z Using 16 MiB out of 16 MiB requested for signature cache, able to store 524288 elements 2025-10-27T17:10:29Z Using 16 MiB out of 16 MiB requested for script execution cache, able to store 524288 elements 2025-10-27T17:10:29Z init message: Loading block index… 2025-10-27T17:10:29Z Validating signatures for all blocks. 2025-10-27T17:10:29Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000 2025-10-27T17:10:29Z LoadBlockIndexDB: last block file = 0 2025-10-27T17:10:29Z LoadBlockIndexDB: last block file info: CBlockFileInfo(blocks=0, size=0, heights=0…0, time=1970-01-01…1970-01-01) 2025-10-27T17:10:29Z Checking all blk files are present… 2025-10-27T17:10:29Z Initializing chainstate Chainstate [ibd] @ height -1 (null) 2025-10-27T17:10:29Z Opening LevelDB in /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/chainstate 2025-10-27T17:10:29Z Opened LevelDB successfully 2025-10-27T17:10:29Z Wrote new obfuscate key for /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/chainstate: 224e6c7c34b6b019 2025-10-27T17:10:29Z Using obfuscation key for /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.0w5H0uf0Uy/regtest/chainstate: 224e6c7c34b6b019 2025-10-27T17:10:29Z init message: Verifying blocks… 2025-10-27T17:10:29Z Block index and chainstate loaded 2025-10-27T17:10:29Z Setting NODE_NETWORK on non-prune mode 2025-10-27T17:10:29Z initload thread start 2025-10-27T17:10:29Z UpdateTip: new best=0f9188f13cb7b2c71f2a335e3a4fc328bf5beb436012afca590b1a11466e2206 height=0 version=0x00000001 log2_work=1.000000 tx=1 date=‘2011-02-02T23:16:42Z’ progress=1.000000 cache=0.3MiB(0txo) 2025-10-27T17:10:29Z block tree size = 1 2025-10-27T17:10:29Z nBestHeight = 0 2025-10-27T17:10:29Z Failed to open mempool file. Continuing anyway. 2025-10-27T17:10:29Z initload thread exit 2025-10-27T17:10:29Z torcontrol thread start 2025-10-27T17:10:29Z Bound to 127.0.0.1:17779 2025-10-27T17:10:29Z Bound to [::]:17778 2025-10-27T17:10:29Z Bound to 0.0.0.0:17778 2025-10-27T17:10:29Z 0 block-relay-only anchors will be tried for connections. 2025-10-27T17:10:29Z init message: Starting network threads… 2025-10-27T17:10:29Z net thread start 2025-10-27T17:10:29Z dnsseed thread start 2025-10-27T17:10:29Z addcon thread start 2025-10-27T17:10:29Z msghand thread start 2025-10-27T17:10:29Z Loading addresses from DNS seed dummySeed.invalid. 2025-10-27T17:10:29Z init message: Done loading 2025-10-27T17:10:29Z opencon thread start 2025-10-27T17:10:29Z 0 addresses found from DNS seeds 2025-10-27T17:10:29Z dnsseed thread exit

    ❯ bitcoind -regtest -noconf -datadir=(mktemp -d) -rpcuser=user -rpcpassword=password -rpcport=18889 -port=17778 -zmqpubrawblock=tcp://localhost:10000 -debug 2025-10-27T17:12:31Z Bitcoin Core version v29.0.0 (release build) 2025-10-27T17:12:31Z Using the ‘arm_shani(1way,2way)’ SHA256 implementation 2025-10-27T17:12:31Z [rand] Feeding 22886 bytes of environment data into RNG 2025-10-27T17:12:31Z Default data directory /Users/torkel/Library/Application Support/Bitcoin 2025-10-27T17:12:31Z Using data directory /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.DuVJxjyfXp/regtest 2025-10-27T17:12:31Z Config file: 2025-10-27T17:12:31Z Command-line arg: conf=false 2025-10-27T17:12:31Z Command-line arg: datadir="/var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.DuVJxjyfXp" 2025-10-27T17:12:31Z Command-line arg: debug="" 2025-10-27T17:12:31Z Command-line arg: port=“17778” 2025-10-27T17:12:31Z Command-line arg: regtest="" 2025-10-27T17:12:31Z Command-line arg: rpcpassword=**** 2025-10-27T17:12:31Z Command-line arg: rpcport=“18889” 2025-10-27T17:12:31Z Command-line arg: rpcuser=**** 2025-10-27T17:12:31Z Command-line arg: zmqpubrawblock=“tcp://localhost:10000” 2025-10-27T17:12:31Z Using at most 125 automatic connections (285 file descriptors available) 2025-10-27T17:12:31Z scheduler thread start 2025-10-27T17:12:31Z [http] Allowing HTTP connections from: 127.0.0.0/8 ::1/128 2025-10-27T17:12:31Z Binding RPC on address ::1 port 18889 2025-10-27T17:12:31Z [libevent] event_add: event: 0x6000025c8038 (fd 10), EV_READ call 0x100dee7b0 2025-10-27T17:12:31Z [libevent] Bound to port 18889 - Awaiting connections … 2025-10-27T17:12:31Z Binding RPC on address 127.0.0.1 port 18889 2025-10-27T17:12:31Z [libevent] event_add: event: 0x6000025c80f8 (fd 11), EV_READ call 0x100dee7b0 2025-10-27T17:12:31Z [libevent] Bound to port 18889 - Awaiting connections … 2025-10-27T17:12:31Z [http] Initialized HTTP server 2025-10-27T17:12:31Z [http] creating work queue of depth 64 2025-10-27T17:12:31Z [rpc] Starting RPC 2025-10-27T17:12:31Z [rpc] Starting HTTP RPC server 2025-10-27T17:12:31Z Config options rpcuser and rpcpassword will soon be deprecated. Locally-run instances may remove rpcuser to use cookie-based auth, or may be replaced with rpcauth. Please see share/rpcauth for rpcauth auth generation. 2025-10-27T17:12:31Z [http] Registering HTTP handler for / (exactmatch 1) 2025-10-27T17:12:31Z [http] Registering HTTP handler for /wallet/ (exactmatch 0) 2025-10-27T17:12:31Z Starting HTTP server with 16 worker threads 2025-10-27T17:12:31Z [http] Entering http event loop 2025-10-27T17:12:31Z Using wallet directory /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.DuVJxjyfXp/regtest/wallets 2025-10-27T17:12:31Z init message: Verifying wallet(s)… 2025-10-27T17:12:31Z Using /16 prefix for IP bucketing 2025-10-27T17:12:31Z init message: Loading P2P addresses… 2025-10-27T17:12:31Z Creating peers.dat because the file was not found ("/var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.DuVJxjyfXp/regtest/peers.dat") 2025-10-27T17:12:31Z init message: Loading banlist… 2025-10-27T17:12:31Z Recreating the banlist database 2025-10-27T17:12:31Z [net] Flushed 0 banned node addresses/subnets to disk 0ms 2025-10-27T17:12:31Z [net] setting try another outbound peer=false 2025-10-27T17:12:31Z SetNetworkActive: true 2025-10-27T17:12:31Z /var/folders/91/w34lrpx12hl46htkt8l7ntph0000gn/T/tmp.DuVJxjyfXp/regtest/fee_estimates.dat is not found. Continue anyway. 2025-10-27T17:12:31Z [zmq] version 4.3.5 2025-10-27T17:12:31Z [zmq] Initialize notification interface 2025-10-27T17:12:31Z [zmq] Outbound message high water mark for pubrawblock at tcp://localhost:10000 is 1000 2025-10-27T17:12:31Z [zmq] Error: Failed to bind address, msg: Address already in use 2025-10-27T17:12:31Z [zmq] Notifier pubrawblock failed (address = tcp://localhost:10000) 2025-10-27T17:12:31Z [zmq] Shutdown notification interface 2025-10-27T17:12:31Z [zmq] Shutdown notifier pubrawblock at tcp://localhost:10000

    How did you obtain Bitcoin Core

    Pre-built binaries

    What version of Bitcoin Core are you using?

    v29.0.0

    Operating system and version

    MacOS 15.6

    Machine specifications

    No response

  2. pinheadmz commented at 6:30 pm on October 27, 2025: member

    2025-10-27T17:12:31Z [zmq] Error: Failed to bind address, msg: Address already in use

    This was in your log … ?

  3. pinheadmz commented at 6:31 pm on October 27, 2025: member
    Do you think bitcoin should fail to initialize if it cant bind? (same as rpc?)
  4. torkelrogstad commented at 6:57 pm on October 27, 2025: contributor

    2025-10-27T17:12:31Z [zmq] Error: Failed to bind address, msg: Address already in use

    This was in your log … ?

    Yes, when I enabled debug. Before enabling debug I was very confused as to why I wasn’t seeing anything with getzmqnotifications.

    Do you think bitcoin should fail to initialize if it cant bind? (same as rpc?)

    Yes, ideally. As I said above, I think failing hard is best, and then a clear non-debug log entry is the second best solution.

  5. fanquake added the label RPC/REST/ZMQ on Oct 28, 2025
  6. willcl-ark commented at 2:27 pm on October 28, 2025: member
    I agree on both counts. If a user has configured zmq but it fails to bind I think we should log this at a higher level than debug, and I agree that the node aborting startup is most likely the correct action to take.

github-metadata-mirror

This is a metadata mirror of the GitHub repository bitcoin/bitcoin. This site is not affiliated with GitHub. Content is generated from a GitHub metadata backup.
generated: 2025-11-02 18:12 UTC

This site is hosted by @0xB10C
More mirrored repositories can be found on mirror.b10c.me