Closed atroxes closed 5 years ago
Can you post your network-related config before and after (SERVICES and REPORT_SERVICES) please.
I run 4 servers; they have IPv4 peers as normal
Also which COIN are you using? How many IPv4 peers are there normally?
COIN: BitcoinCashABC
Usually ~20 peers are available.
Before:
HOST =
TCP_PORT = 50001
SSL_PORT = 50002
RPC_HOST = 127.0.0.1
REPORT_HOST = hostname.tld
REPORT_TCP_PORT = 50001
REPORT_SSL_PORT = 50002
After:
SERVICES=ssl://:50002,tcp://:50001,rpc://,ws://:50003,wss://:50004
REPORT_SERVICES=ssl://hostname.tld:50002,tcp://hostname.tld:50001,ws://hostname.tld:50003,wss://hostname.tld:50004
"hostname.tld" does resolve correctly to IPv4 and IPv6. Clients are able to connect without issue.
When I try adding a IPv4-only peer:
$ electrumx_rpc add_peer "electrum.leblancnet.us v1.0 s50002 t"
"peer 'electrum.leblancnet.us v1.0 s50002 t' added"
The log shows:
INFO:PeerManager:[electrum.leblancnet.us:50002 SSL] [Errno 22] Invalid argument
INFO:PeerManager:[electrum.leblancnet.us:50002 SSL] [Errno -5] No address associated with hostname
When I do the same with a IPv4 and IPv6 capable peer:
electrumx_rpc add_peer "electron.jochen-hoenicke.de v1.0 s51002 t"
The log shows:
INFO:PeerManager:[electron.jochen-hoenicke.de:51002 SSL] verified in 0.4s
Outgoing IPv4 works on the host.
Here are the first few lines of peers for my ABC server, it has no IPv4 issues:
Host Status TCP SSL Server Min Max Pruning Last Good Last Try Tries Source IP Address
electrum.leblancnet.us good 50011 50012 ElectronX 1.9.4 1.2 1.4.1 54m 58s 55m 00s 0 peer 205.197.210.30
bch.loping.net good 50001 50002 ElectronX 1.10.1 1.2 1.4.1 55m 27s 55m 28s 0 peer 96.30.73.184
bitcoincash.quangld.com good 50001 50002 ElectrumX 1.11.0 1.4 1.4.2 55m 30s 55m 31s 0 peer 14.161.3.136
electron.coinucopia.io good 50001 50002 ElectronX 1.8.12 1.2 1.4 55m 34s 55m 35s 0 peer 138.197.193.154
bch0.kister.net good 50001 50002 ElectronX 1.10.1 1.2 1.4.1 55m 40s 55m 41s 0 peer 100.11.124.171
Strange. I tried completely clearing out Python on my system, including all packages and rebuilding Python 3.7.3 from scratch, but without luck. It seems like it doesn't even want to consider using IPv4 for connecting to other peers.
Going back to the tagged 1.11.0 release, clearing pip packages and doing 'setup.py install', everything now works as usual again.
Can you try git HEAD commit https://github.com/kyuupichan/electrumx/commit/142909bcd448befdd7d0f481f4bbae8f03ab7ce7? If that doesn't work, does changing
async with connect_rs(peer.host, port, session_factory=PeerSession,
at line 275 of peers.py with
async with connect_rs(str(peer.host), port, session_factory=PeerSession,
solve the issue?
No luck unfortunately. I'll do some trial and error to see specifically what commit makes a difference. I can reliably go back to tag 1.11.0, so something in between must be the kicker.
I'm somewhat suspicious of the Invalid Argument error you see; it's a shame it's not more informative. Can you change line 286 of peers.py from self.logger.error to self.logger.exception? That will give a backtrace and hopefully at least give a clue what might be going wrong.
Changing line 286 didn't change anything, but noticed self.logger.info
in the OSError
section a few lines below on line 289, so tried changing that to self.logger.exception. That caused some traceback output:
OSError: [Errno 22] Invalid argument
ERROR:PeerManager:[wallet.satoshiscoffeehouse.com:50001 TCP] [Errno 22] Invalid argument
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/electrumX-1.11.0-py3.7.egg/electrumx/server/peers.py", line 276, in _should_drop_peer
**kwargs) as session:
File "/usr/local/lib/python3.7/site-packages/aiorpcX-0.18.0-py3.7.egg/aiorpcx/rawsocket.py", line 166, in __aenter__
_transport, protocol = await self.create_connection()
File "/usr/local/lib/python3.7/site-packages/aiorpcX-0.18.0-py3.7.egg/aiorpcx/rawsocket.py", line 163, in create_connection
self.protocol_factory, self.host, self.port, **self.kwargs)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 959, in create_connection
raise exceptions[0]
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 946, in create_connection
await self.sock_connect(sock, address)
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 464, in sock_connect
return await fut
File "/usr/local/lib/python3.7/asyncio/selector_events.py", line 469, in _sock_connect
sock.connect(address)
OSError: [Errno 22] Invalid argument
INFO:ElectrumX:[0] SSL xx.xx.xx.xx:xx, 0 total
ERROR:PeerManager:[bch.imaginary.cash:50001 TCP] [Errno -5] No address associated with hostname
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/electrumX-1.11.0-py3.7.egg/electrumx/server/peers.py", line 276, in _should_drop_peer
**kwargs) as session:
File "/usr/local/lib/python3.7/site-packages/aiorpcX-0.18.0-py3.7.egg/aiorpcx/rawsocket.py", line 166, in __aenter__
_transport, protocol = await self.create_connection()
File "/usr/local/lib/python3.7/site-packages/aiorpcX-0.18.0-py3.7.egg/aiorpcx/rawsocket.py", line 163, in create_connection
self.protocol_factory, self.host, self.port, **self.kwargs)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 910, in create_connection
type=socket.SOCK_STREAM, proto=proto, flags=flags, loop=self)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1279, in _ensure_resolved
proto=proto, flags=flags)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 789, in getaddrinfo
None, getaddr_func, host, port, family, type, proto, flags)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
ERROR:PeerManager:[wallet.satoshiscoffeehouse.com:50001 TCP] [Errno -5] No address associated with hostname
Traceback (most recent call last):
File "/usr/local/lib/python3.7/site-packages/electrumX-1.11.0-py3.7.egg/electrumx/server/peers.py", line 276, in _should_drop_peer
**kwargs) as session:
File "/usr/local/lib/python3.7/site-packages/aiorpcX-0.18.0-py3.7.egg/aiorpcx/rawsocket.py", line 166, in __aenter__
_transport, protocol = await self.create_connection()
File "/usr/local/lib/python3.7/site-packages/aiorpcX-0.18.0-py3.7.egg/aiorpcx/rawsocket.py", line 163, in create_connection
self.protocol_factory, self.host, self.port, **self.kwargs)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 910, in create_connection
type=socket.SOCK_STREAM, proto=proto, flags=flags, loop=self)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 1279, in _ensure_resolved
proto=proto, flags=flags)
File "/usr/local/lib/python3.7/asyncio/base_events.py", line 789, in getaddrinfo
None, getaddr_func, host, port, family, type, proto, flags)
File "/usr/local/lib/python3.7/concurrent/futures/thread.py", line 57, in run
result = self.fn(*self.args, **self.kwargs)
File "/usr/local/lib/python3.7/socket.py", line 748, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno -5] No address associated with hostname
Also, side note, I'm unable to run commit 4120596fb8e2c87dd63efc8db7f820842e57b5e5 and anything newer, starts failing with a bunch of similar errors about hostname resolution.
eb7cea5ecd81ba5a8f8b331d3c3e46dcc9097750 runs without issue for me.
This all sounds like this Python bug https://bugs.python.org/issue35302 I filed which shows no signs of being fixed. At least, it makes analyzing the problem much harder. I don't really want to play ping-pong trying things with you in this issue. Not really sure what to do :(
Well, it looks like you found the culprit. I'll stick to eb7cea5ecd81ba5a8f8b331d3c3e46dcc9097750 for now and wait it out. Thank you for your time!
Currently using commit 04c409ddacca313a9cc8519de8d6cb2af4721407.
Reconfigured SERVICES and REPORT_SERVICES accordingly, things seem to be working and clients can connect to me on IPv4 and IPv6.
However, starting up, there are many log entries showing:
My peers list is now only populated with the peers that have working IPv6, no connections to IPv4 at all.
DNS on the host is functional and IPv4 to other peers was working on 1.11.0.