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

issue TheBlueMatt openend 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:

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

     0# ifconfig
     1eth0: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
     2        inet 172.17.0.2  netmask 255.255.0.0  broadcast 172.17.255.255
     3        ether 02:42:ac:11:00:02  txqueuelen 0  (Ethernet)
     4        RX packets 195  bytes 218835 (218.8 KB)
     5        RX errors 0  dropped 0  overruns 0  frame 0
     6        TX packets 131  bytes 7323 (7.3 KB)
     7        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
     8
     9lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
    10        inet 127.0.0.1  netmask 255.0.0.0
    11        loop  txqueuelen 1000  (Local Loopback)
    12        RX packets 24  bytes 1200 (1.2 KB)
    13        RX errors 0  dropped 0  overruns 0  frame 0
    14        TX packets 24  bytes 1200 (1.2 KB)
    15        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0
    
    02023-04-07T16:41:56Z Binding RPC on address ::1 port 18443
    12023-04-07T16:41:56Z [libevent:warning] getaddrinfo: address family for nodename not supported
    22023-04-07T16:41:56Z Binding RPC on address ::1 port 18443 failed.
    32023-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).


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: 2024-07-01 10:13 UTC

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