invalid zmq argument syntax on windows causes abort #17185

issue ysangkok openend this issue on October 18, 2019
  1. ysangkok commented at 7:13 am on October 18, 2019: none

    Version: 0.18.1 (64-bit) on Windows 10.0.18362.418

    Using the following config, bitcoind crashes.

    This is not #15808 because the assignments are within the regtest section (see the comment on that issue).

    Seems like it is #7496 reappearing.

    0[regtest]
    1rpcuser=user
    2rpcpassword=pass
    3rpcport=8332
    4server=1
    5zmqpubrawblock=127.0.0.1:40000
    6zmqpubrawtx=127.0.0.1:40000
    
     0PS C:\Program Files\Bitcoin\daemon> .\bitcoind -regtest -txindex
     12019-10-18T07:05:41Z Bitcoin Core version v0.18.1 (release build)
     22019-10-18T07:05:41Z Validating signatures for all blocks.
     32019-10-18T07:05:41Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000
     42019-10-18T07:05:41Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
     52019-10-18T07:05:41Z Using RdSeed as additional entropy source
     62019-10-18T07:05:41Z Using RdRand as an additional entropy source
     72019-10-18T07:05:41Z Default data directory C:\Users\janus\AppData\Roaming\Bitcoin
     82019-10-18T07:05:41Z Using data directory C:\Users\janus\AppData\Roaming\Bitcoin\regtest
     92019-10-18T07:05:41Z Config file: C:\Users\janus\AppData\Roaming\Bitcoin\bitcoin.conf
    102019-10-18T07:05:41Z Using at most 125 automatic connections (2048 file descriptors available)
    112019-10-18T07:05:41Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
    122019-10-18T07:05:41Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
    132019-10-18T07:05:41Z Using 4 threads for script verification
    142019-10-18T07:05:41Z scheduler thread start
    152019-10-18T07:05:41Z libevent: getaddrinfo: nodename nor servname provided, or not known
    162019-10-18T07:05:41Z Binding RPC on address ::1 port 8332 failed.
    172019-10-18T07:05:41Z HTTP: creating work queue of depth 16
    182019-10-18T07:05:41Z 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.
    192019-10-18T07:05:41Z HTTP: starting 4 worker threads
    202019-10-18T07:05:41Z Using wallet directory C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets
    212019-10-18T07:05:41Z init message: Verifying wallet(s)...
    222019-10-18T07:05:41Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
    232019-10-18T07:05:41Z Using wallet C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets
    242019-10-18T07:05:41Z BerkeleyEnvironment::Open: LogDir=C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets\database ErrorFile=C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets\db.log
    252019-10-18T07:05:42Z init message: Loading banlist...
    262019-10-18T07:05:42Z ERROR: DeserializeFileDB: Failed to open file C:\Users\janus\AppData\Roaming\Bitcoin\regtest\banlist.dat
    272019-10-18T07:05:42Z Invalid or missing banlist.dat; recreating
    28Assertion failed!
    29
    30Program: C:\Program Files\Bitcoin\daemon\bitcoind.exe
    31File: zmq/zmqpublishnotifier.cpp, Line 115
    32
    33Expression: psocket
    34PS C:\Program Files\Bitcoin\daemon>
    
  2. ysangkok added the label Bug on Oct 18, 2019
  3. ysangkok commented at 7:20 am on October 18, 2019: none
    Same issue in WSL and when running in an administrator prompt. Dunno why the port bind on 8332 is failing. Don’t think I have anything running there, if I try to connect netcat to that local port, I get ‘Connection Refused’.
  4. laanwj commented at 9:07 am on October 18, 2019: member

    This is the assertion it crashes on:

    0void CZMQAbstractPublishNotifier::Shutdown()
    1{
    2    assert(psocket);
    
    • The bind problem is not fatal (it means it cannot bind on IPv6 localhost, but it will still have bound on IPv4 localhost), and continues after it.
    • The missing banlist is also not fatal.

    So I expect it’s the zmq arguments.

    Can you try a different syntax?

    0zmqpubrawblock=tcp://127.0.0.1:40000
    1zmqpubrawtx=tcp://127.0.0.1:40000
    
  5. fanquake added the label RPC/REST/ZMQ on Oct 18, 2019
  6. fanquake added the label Windows on Oct 18, 2019
  7. ysangkok commented at 4:04 pm on October 18, 2019: none

    The syntax you propose works, but i don’t think it should crash with invalid syntax. It would make sense to default to tcp since it is arguably more popular than named pipes.

    On Fri, 18 Oct 2019, 04:12 Wladimir J. van der Laan, < notifications@github.com> wrote:

    This is the assertion it crashes on:

    void CZMQAbstractPublishNotifier::Shutdown() { assert(psocket);

    • The bind problem is not fatal (it means it cannot bind on IPv6 localhost, but it will still have bound on IPv4 localhost), and continues after it.
    • The missing banlist is also not fatal.

    So I expect it’s the zmq arguments.

    Can you try a different syntax?

    zmqpubrawblock=tcp://127.0.0.1:40000 zmqpubrawtx=tcp://127.0.0.1:40000

    — You are receiving this because you authored the thread. Reply to this email directly, view it on GitHub https://github.com/bitcoin/bitcoin/issues/17185?email_source=notifications&email_token=AACFK5YI3XQEWPGPVYA7DZLQPF4YFA5CNFSM4JCDPC7KYY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOEBTPGNQ#issuecomment-543617846, or unsubscribe https://github.com/notifications/unsubscribe-auth/AACFK52STQFUUDUOMMSGVK3QPF4YFANCNFSM4JCDPC7A .

  8. promag commented at 7:50 pm on October 18, 2019: member
    I agree it should not crash. Not sure if it should default to tpc but at least should fail to start with an error message.
  9. ysangkok renamed this:
    zmq on windows causes abort
    invalid zmq argument syntax on windows causes abort
    on Oct 18, 2019
  10. promag commented at 4:31 pm on November 2, 2019: member

    In macos I get:

    0./src/bitcoind -regtest -debug -zmqpubrawtx=foo
    1
    2...
    32019-11-02T16:29:37Z zmq: Error: Failed to bind address, errno=Invalid argument
    42019-11-02T16:29:37Z zmq: Notifier pubrawtx failed (address = foo)
    52019-11-02T16:29:37Z zmq: Shutdown notification interface
    62019-11-02T16:29:37Z zmq: Shutdown notifier pubrawtx at foo
    7...
    

    And doesn’t abort. Can you also check the output with -debug argument?

  11. ysangkok commented at 7:05 pm on November 9, 2019: none

    @promag log with -debug , as you requested:

     0PS C:\Program Files\Bitcoin\daemon> .\bitcoind -regtest -txindex -debug
     12019-11-09T19:04:17Z Bitcoin Core version v0.18.1 (release build)
     22019-11-09T19:04:17Z Validating signatures for all blocks.
     32019-11-09T19:04:17Z Setting nMinimumChainWork=0000000000000000000000000000000000000000000000000000000000000000
     42019-11-09T19:04:17Z Using the 'sse4(1way),sse41(4way),avx2(8way)' SHA256 implementation
     52019-11-09T19:04:17Z Using RdSeed as additional entropy source
     62019-11-09T19:04:17Z Using RdRand as an additional entropy source
     72019-11-09T19:04:17Z Default data directory C:\Users\janus\AppData\Roaming\Bitcoin
     82019-11-09T19:04:17Z Using data directory C:\Users\janus\AppData\Roaming\Bitcoin\regtest
     92019-11-09T19:04:17Z Config file: C:\Users\janus\AppData\Roaming\Bitcoin\bitcoin.conf
    102019-11-09T19:04:17Z Using at most 125 automatic connections (2048 file descriptors available)
    112019-11-09T19:04:17Z Using 16 MiB out of 32/2 requested for signature cache, able to store 524288 elements
    122019-11-09T19:04:17Z Using 16 MiB out of 32/2 requested for script execution cache, able to store 524288 elements
    132019-11-09T19:04:17Z Using 4 threads for script verification
    142019-11-09T19:04:17Z scheduler thread start
    152019-11-09T19:04:17Z Allowing HTTP connections from: 127.0.0.0/8 ::1/128
    162019-11-09T19:04:17Z Binding RPC on address ::1 port 8332
    172019-11-09T19:04:17Z libevent: getaddrinfo: nodename nor servname provided, or not known
    182019-11-09T19:04:17Z Binding RPC on address ::1 port 8332 failed.
    192019-11-09T19:04:17Z Binding RPC on address 127.0.0.1 port 8332
    202019-11-09T19:04:17Z Initialized HTTP server
    212019-11-09T19:04:17Z HTTP: creating work queue of depth 16
    222019-11-09T19:04:17Z Starting RPC
    232019-11-09T19:04:17Z Starting HTTP RPC server
    242019-11-09T19:04:17Z 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.
    252019-11-09T19:04:17Z Registering HTTP handler for / (exactmatch 1)
    262019-11-09T19:04:17Z Registering HTTP handler for /wallet/ (exactmatch 0)
    272019-11-09T19:04:17Z Starting HTTP server
    282019-11-09T19:04:17Z HTTP: starting 4 worker threads
    292019-11-09T19:04:17Z Entering http event loop
    302019-11-09T19:04:17Z Using wallet directory C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets
    312019-11-09T19:04:17Z init message: Verifying wallet(s)...
    322019-11-09T19:04:17Z Using BerkeleyDB version Berkeley DB 4.8.30: (April  9, 2010)
    332019-11-09T19:04:17Z Using wallet C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets
    342019-11-09T19:04:17Z BerkeleyEnvironment::Open: LogDir=C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets\database ErrorFile=C:\Users\janus\AppData\Roaming\Bitcoin\regtest\wallets\db.log
    352019-11-09T19:04:17Z init message: Loading banlist...
    362019-11-09T19:04:17Z Loaded 0 banned node ips/subnets from banlist.dat  0ms
    372019-11-09T19:04:17Z net: setting try another outbound peer=false
    382019-11-09T19:04:17Z zmq: version 4.3.1
    392019-11-09T19:04:17Z zmq: Initialize notification interface
    402019-11-09T19:04:17Z zmq: Outbound message high water mark for pubrawblock at 127.0.0.1:40000 is 1000
    412019-11-09T19:04:17Z zmq: Error: Failed to bind address, errno=Invalid argument
    422019-11-09T19:04:17Z zmq: Notifier pubrawblock failed (address = 127.0.0.1:40000)
    432019-11-09T19:04:17Z zmq: Shutdown notification interface
    442019-11-09T19:04:17Z zmq: Shutdown notifier pubrawblock at 127.0.0.1:40000
    452019-11-09T19:04:17Z zmq: Shutdown notifier pubrawtx at 127.0.0.1:40001
    46Assertion failed!
    47
    48Program: C:\Program Files\Bitcoin\daemon\bitcoind.exe
    49File: zmq/zmqpublishnotifier.cpp, Line 115
    50
    51Expression: psocket
    
  12. laanwj commented at 2:24 pm on November 10, 2019: member

    It would make sense to default to tcp since it is arguably more popular than named pipes.

    I disagree that the project should be making these kinds of calls. The arguments are provided as-is to zmq, it’s up to the user to provide correct input. Ignoring invalid or ambigious input is even worse.

    But I agree that crashing on an error is bad user experience, it should just print an error message and exit.

  13. promag commented at 10:17 pm on November 11, 2019: member
    This is also happens in other operative systems.
  14. laanwj closed this on Jan 8, 2020

  15. sidhujag referenced this in commit 313253aa87 on Jan 8, 2020
  16. sidhujag referenced this in commit c9311433b0 on Nov 10, 2020
  17. DrahtBot locked this on Feb 15, 2022
  18. Munkybooty referenced this in commit 12df805315 on Jun 9, 2022
  19. Munkybooty referenced this in commit b52e6cdd62 on Jun 21, 2022
  20. Munkybooty referenced this in commit f06a2cf477 on Jun 25, 2022
  21. Munkybooty referenced this in commit d9ebbb49cf on Jun 28, 2022
  22. Munkybooty referenced this in commit f4227ec1f3 on Jul 6, 2022
  23. Munkybooty referenced this in commit efe727a4a8 on Aug 3, 2022
  24. Munkybooty referenced this in commit a70021e6c5 on Aug 16, 2022

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-12-02 21:13 UTC

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