kyuupichan / electrumx

Alternative implementation of spesmilo/electrum-server
Other
724 stars 733 forks source link

non fatal error: Address family for hostname not supported #682

Open gits7r opened 5 years ago

gits7r commented 5 years ago

I am getting this as I am starting up my e-x server running 1.8.12:

electrumx_server[581]: ERROR:asyncio:Future exception was never retrieved electrumx_server[581]: future: <Future finished exception=gaierror(-9, 'Address family for hostname not supported')> electrumx_server[581]: Traceback (most recent call last): electrumx_server[581]: File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run electrumx_server[581]: result = self.fn(*self.args, **self.kwargs) electrumx_server[581]: File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo electrumx_server[581]: for res in _socket.getaddrinfo(host, port, family, type, proto, flags): electrumx_server[581]: socket.gaierror: [Errno -9] Address family for hostname not supported

I have in my electrumx,.conf dual stack (IPv4 and IPv6) at HOST =, and the IPv6 address is not between [ ] but it works ok as it binds to it and opens the port properly. I also report my Tor host as a v3 onion service address (unlike the legacy ones, these are much longer strings of whole ed25519 public keys base32 encoded) -- but I fail to see as these being the reason triggering this. I have the same setup on a different server where I don't catch this.

kyuupichan commented 5 years ago

Can you please give me all your network-related env vars.

kyuupichan commented 5 years ago

Are your Python versions the same? There are several bugs in 3.6, particularly earlier ones like 3.6.1

gits7r commented 5 years ago

Negative, Python versions are not the same and your hint might make sense:

Server not giving the error runs Python 3.7.0 (default, Sep 9 2018, 18:53:14)

Server giving the error runs Python 3.6.5rc1

What do you need from network related env vars? should I paste my electrumx.conf file here? I am just using: HOST = IPv4,IPv6 TCP_PORT = 50001 SSL_PORT = 50002 TOR_PROXY_HOST = 127.0.0.1 TOR_PROXY_PORT = 9050 REPORT_HOST = domain.tld REPORT_TCP_PORT = 50001 REPORT_SSL_PORT = 50002 REPORT_HOST_TOR = v3 onion address (long type one) REPORT_TCP_PORT_TOR = 50001 REPORT_SSL_PORT_TOR = 50002

Could it be that there's a bug in Python 3.6.5rc1 and nothing needs to be patched to electrumx ?

kyuupichan commented 5 years ago

It's hard to guess. There is still a bug in address resolution in Python 3.7 that I submitted a few weeks ago: https://bugs.python.org/issue35302

gits7r commented 5 years ago

RIght. It is in Python 3.7 as well:

project-management electrumx_server[7230]: INFO:PeerManager:[electrumx-core.1209k.com:50002 SSL] [Errno -9] error while attempting to bind on address ('MY_IPv4', 0): address family for hostname not supported Jan 06 13:01:14 project-management electrumx_server[7230]: INFO:PeerManager:[electrumx-core.1209k.com:50001 TCP] [Errno -9] error while attempting to bind on address ('MY_IPv4', 0): address family for hostname not supported

As I can see, the peer electrumx-core.1209k.com resolves to only AAAA (IPv6): Name: electrumx-core.1209k.com Address: 2601:602:8802:2091:dcc3:26ff:fe77:bd7f

And according to journalctl it tries to bind to my IPv4, instead of my IPv6. I have native IPv6 on the machines, on the same network interface with IPv4 as inet and inet6 of course. But it appears it's the bug in Python you linked.. or it could be. Is it getting close to your case on MAC?

gits7r commented 5 years ago

From initial digging it seams like this is triggered for peers that report a HOST that only resolves to IPv6 address, not dual-stacked ones (IPv4 and IPv6). Keeping an eye on this to further confirm but seams like this is the case.

gits7r commented 5 years ago

I catch also with peers that do not resolve to IPv6 only, and are not even dual-stacked (no IPv6 at all).

This is for when a peer triggers it via PeerManager:

ERROR:PeerManager:[ip120.ip-54-37-91.eu:50002 SSL] RPC error: unsupported protocol version: ['1.2', '1.4'] (-103) INFO:PeerManager:[ip120.ip-54-37-91.eu:50002 SSL] [Errno -5] No address associated with hostname ERROR:PeerManager:[ip120.ip-54-37-91.eu:50001 TCP] RPC error: unsupported protocol version: ['1.2', '1.4'] (-103) INFO:PeerManager:[ip120.ip-54-37-91.eu:50001 TCP] [Errno -5] No address associated with hostname ERROR:asyncio:Future exception was never retrieved future: <Future finished exception=gaierror(-9, 'Address family for hostname not supported')> Traceback (most recent call last): File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, *self.kwargs) File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -9] Address family for hostname not supported ERROR:asyncio:Future exception was never retrieved future: <Future finished exception=gaierror(-9, 'Address family for hostname not supported')> Traceback (most recent call last): File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(self.args, **self.kwargs) File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -9] Address family for hostname not supported

And it is sometimes triggered by connecting clients, but unlike PeerManager here there is no info about the client that is triggering it (like a rDNS hostname or IPv4 or IPv6 address):

INFO:ElectrumX:[12577] TCP xx.xx.xx.xx:xx, 212 total ERROR:asyncio:Future exception was never retrieved future: <Future finished exception=gaierror(-9, 'Address family for hostname not supported')> Traceback (most recent call last): File "/usr/lib/python3.6/concurrent/futures/thread.py", line 56, in run result = self.fn(*self.args, **self.kwargs) File "/usr/lib/python3.6/socket.py", line 745, in getaddrinfo for res in _socket.getaddrinfo(host, port, family, type, proto, flags): socket.gaierror: [Errno -9] Address family for hostname not supported

Talkless commented 5 years ago

Just got similar error:

Feb 11 19:28:19 odroid-hc1 electrumx[26789]: INFO:PeerManager:forgetting unreachable peer: ip239.ip-54-36-234.eu
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: ERROR:asyncio:Future exception was never retrieved
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: future: <Future finished exception=gaierror(-9, 'Address family for hostname not supported')>
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: Traceback (most recent call last):
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:   File "/opt/python3.6/lib/python3.6/concurrent/futures/thread.py", line 56, in run
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:     result = self.fn(*self.args, **self.kwargs)
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:   File "/opt/python3.6/lib/python3.6/socket.py", line 745, in getaddrinfo
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: socket.gaierror: [Errno -9] Address family for hostname not supported
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: ERROR:asyncio:Future exception was never retrieved
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: future: <Future finished exception=gaierror(-9, 'Address family for hostname not supported')>
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: Traceback (most recent call last):
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:   File "/opt/python3.6/lib/python3.6/concurrent/futures/thread.py", line 56, in run
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:     result = self.fn(*self.args, **self.kwargs)
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:   File "/opt/python3.6/lib/python3.6/socket.py", line 745, in getaddrinfo
Feb 11 19:29:01 odroid-hc1 electrumx[26789]:     for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
Feb 11 19:29:01 odroid-hc1 electrumx[26789]: socket.gaierror: [Errno -9] Address family for hostname not supported
# pip3 freeze
aiohttp==3.3.2
aiorpcX==0.7.3
async-timeout==3.0.0
attrs==18.1.0
chardet==3.0.4
electrumX==1.9.5
idna==2.7
idna-ssl==1.0.1
multidict==4.3.1
plyvel==0.9
pylru==1.1.0
yarl==1.2.6

on Debian 9 Arm

gits7r commented 5 years ago

yea I am getting it very heavily as well. I run multiple servers, on Python 3.7 I get it less often (but still get it) than on Python 3.6.x which reports it at least once every 2 minutes. This is an upstream bug in Python itself so we are waiting for that to be fixed, then we'll see how it goes in ElectrumX.

Talkless commented 5 years ago

This is an upstream bug

Oh, thanks for info! Let's wait for the fix then.