RPC wont bind without an IP address on a non-localhost interface #13155

issue TheBlueMatt opened this issue on May 2, 2018
  1. TheBlueMatt commented at 7:11 PM on May 2, 2018: contributor

    If the only interface which has an IP address and is up is lo, one of the two default rpcbinds (:: and 0.0.0.0) will fail with "libevent: getaddrinfo: address family for nodename not supported".

  2. fanquake added the label RPC/REST/ZMQ on May 2, 2018
  3. pinheadmz commented at 5:24 PM on April 7, 2023: member

    I know this is an old one, but can you offer steps to reproduce? I down'ed all interfaces except lo on macOS and rpc bound fine:

    --> ifconfig | grep UP -A 5
    lo0: flags=8049<UP,LOOPBACK,RUNNING,MULTICAST> mtu 16384
    	options=1203<RXCSUM,TXCSUM,TXSTATUS,SW_TIMESTAMP>
    	inet 127.0.0.1 netmask 0xff000000 
    	inet6 ::1 prefixlen 128 
    	inet6 fe80::1%lo0 prefixlen 64 scopeid 0x1 
    	nd6 options=201<PERFORMNUD,DAD>
    
    2023-04-07T17:19:42Z Binding RPC on address ::1 port 18443
    2023-04-07T17:19:42Z Binding RPC on address 127.0.0.1 port 18443
    

    However,

    I did notice that in a docker container with no ipv6 I got the error you reported... but that makes sense so I don't understand if there is still a bug or if you think the error message maybe needs to be changed?

    # ifconfig
    eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
            inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
            ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
            RX packets 195  bytes 218835 (218.8 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 131  bytes 7323 (7.3 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
            inet 127.0.0.1  netmask 255.0.0.0
            loop  txqueuelen 1000  (Local Loopback)
            RX packets 24  bytes 1200 (1.2 KB)
            RX errors 0  dropped 0  overruns 0  frame 0
            TX packets 24  bytes 1200 (1.2 KB)
            TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    2023-04-07T16:41:56Z Binding RPC on address ::1 port 18443
    2023-04-07T16:41:56Z [libevent:warning] getaddrinfo: address family for nodename not supported
    2023-04-07T16:41:56Z Binding RPC on address ::1 port 18443 failed.
    2023-04-07T16:41:56Z Binding RPC on address 127.0.0.1 port 18443
    
  4. pinheadmz commented at 3:58 PM on April 13, 2023: member

    Thanks Matt! Closing for now, lets reopen if it comes up again

  5. pinheadmz closed this on Apr 13, 2023

  6. bitcoin locked this on Apr 12, 2024
  7. bitcoin unlocked this on Jun 10, 2024
  8. maflcko commented at 10:35 AM on June 10, 2024: member

    Reopening for now, because it came up again. cc @m3dwards

  9. maflcko reopened this on Jun 10, 2024

  10. m3dwards commented at 5:18 PM on June 12, 2024: contributor

    I believe this is the same issue as in #30245 but in libevent.

    If you pass ::1 to getaddrinfo when configured with AI_ADDRCONFIG it will check that there is a non loopback IPV6 interface configured. This was to prevent IPV6 DNS lookups on IPV4 only machines which could be slow.

    Please see #30245 for a more full write up and some references.

    As I understand it, there are efforts to replace libevent so rather than attempting to get this behaviour changed upstream in libevent we could just wait for that.

  11. vasild commented at 12:35 PM on June 14, 2024: contributor

    one of the two default rpcbinds (:: and 0.0.0.0) will fail

    Which one? Is it always :: or always 0.0.0.0 or randomly one or the other? I guess there is some mistake here because the default rpcbinds are ::1 and 127.0.0.1 (not :: and 0.0.0.0).

  12. achow101 referenced this in commit ec74f45741 on Jul 18, 2024
  13. PastaPastaPasta referenced this in commit 3e009ea12f on Oct 25, 2024
  14. PastaPastaPasta referenced this in commit 745addf6a7 on Oct 27, 2024
  15. kristapsk commented at 9:37 PM on August 26, 2025: contributor

    Noticed this when there is only IPv6 address assigned to eth0 interface (lo has both 127.0.0.1 and ::1). When IPv4 address is also added to eth0, problem disappears.

    Bitcoin Core version v29.0.0 (release build)
    Using the 'arm_shani(1way,2way)' SHA256 implementation
    Startup time: 2025-08-26T21:30:01Z
    Default data directory /.bitcoin
    Using data directory /ssd/bitcoind/mainnet
    Config file: /home/bitcoind/mainnet.conf
    Config file arg: chain="main"
    Config file arg: datadir="/ssd/bitcoind/mainnet"
    Config file arg: disablewallet="1"
    Config file arg: discover="1"
    Config file arg: externalip="****"
    Config file arg: logtimestamps="0"
    Config file arg: maxconnections="80"
    Config file arg: maxuploadtarget="2048"
    Config file arg: onion="127.0.0.1:9050"
    Config file arg: printtoconsole="1"
    Config file arg: rpcallowip="127.0.0.1"
    Config file arg: rpcauth=****
    Config file arg: rpcbind="127.0.0.1"
    Config file arg: rpcport="8332"
    Config file arg: server="1"
    Config file arg: whitelist="127.0.0.1"
    Config file arg: zmqpubrawblock="tcp://127.0.0.1:8331"
    Config file arg: zmqpubrawtx="tcp://127.0.0.1:8330"
    Command-line arg: conf="/home/bitcoind/mainnet.conf"
    Using at most 80 automatic connections (1024 file descriptors available)
    Wallet disabled!
    scheduler thread start
    Binding RPC on address 127.0.0.1 port 8332
    [libevent:warning] getaddrinfo: address family for nodename not supported
    Binding RPC on address 127.0.0.1 port 8332 failed.
    Unable to bind any endpoint for RPC server
    [error] Unable to start HTTP server. See debug log for details.
    Shutdown: In progress...
    scheduler thread exit
    Shutdown: done
    

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: 2026-05-02 21:15 UTC

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