lbryio / lbry-sdk

The LBRY SDK for building decentralized, censorship resistant, monetized, digital content apps.
https://lbry.com
MIT License
7.19k stars 483 forks source link

handle ValueError: invalid ip address: '192.168.0.1' better #2658

Open tzarebczan opened 4 years ago

tzarebczan commented 4 years ago

@jackrobison is aware of this one.


Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python37-32\lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python37-32\lib\asyncio\selector_events.py", line 962, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\protocol\protocol.py", line 557, in datagram_received
    self.handle_request_datagram(address, message)
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\protocol\protocol.py", line 454, in handle_request_datagram
    peer = make_kademlia_peer(request_datagram.node_id, address[0], address[1])
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\peer.py", line 20, in make_kademlia_peer
    return KademliaPeer(address, node_id, udp_port, tcp_port=tcp_port, allow_localhost=allow_localhost)
  File "<string>", line 8, in __init__
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\peer.py", line 180, in __post_init__
    raise ValueError(f"invalid ip address: '{self.address}'")
ValueError: invalid ip address: '192.168.0.1'
2019-12-09 13:14:37,898 INFO     torba.client.baseledger:138: lbc_mainnet: added BlockHeightEvent(height=679941, change=1) header blocks, final height 679941
Exception in callback _SelectorDatagramTransport._read_ready()
handle: <Handle _SelectorDatagramTransport._read_ready()>
Traceback (most recent call last):
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\protocol\protocol.py", line 452, in handle_request_datagram
    peer = self.routing_table.get_peer(request_datagram.node_id)
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\protocol\routing_table.py", line 210, in get_peer
    return self.buckets[self.kbucket_index(contact_id)].get_peer(contact_id)
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\protocol\routing_table.py", line 70, in get_peer
    raise IndexError(node_id)
IndexError: b'6\x13\xe9\x91\xed\x1c\x14I\xa2[\xb5\xa5]s"\x8dW\x13\x0f#\x85\x15\xb1!\x0c`\x8f\xe2w\xe2\xee\xad\t\n\x85H\x0c3\xdd\xe6\xda\x1f\xf9*\x08\x11*\xd8'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python37-32\lib\asyncio\events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "C:\Users\thoma\AppData\Local\Programs\Python\Python37-32\lib\asyncio\selector_events.py", line 962, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\protocol\protocol.py", line 557, in datagram_received
    self.handle_request_datagram(address, message)
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\protocol\protocol.py", line 454, in handle_request_datagram
    peer = make_kademlia_peer(request_datagram.node_id, address[0], address[1])
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\peer.py", line 20, in make_kademlia_peer
    return KademliaPeer(address, node_id, udp_port, tcp_port=tcp_port, allow_localhost=allow_localhost)
  File "<string>", line 8, in __init__
  File "c:\users\thoma\documents\lbry\lbry\lbry\dht\peer.py", line 180, in __post_init__
    raise ValueError(f"invalid ip address: '{self.address}'")
ValueError: invalid ip address: '192.168.0.1'
belikor commented 3 years ago

I have also seen this error, but I'm not sure what causes it.

My set up is as follows, one PC (1) and one laptop (2) in the same local network 192.168.1.xxx. My PC has lbrynet running most of the time, and I just run lbrynet occasionally on the laptop.

This message about invalid IP is shown on the laptop (2), and refers to the PC's IP address (1). So, it is like the laptop doesn't see correctly the PC as a peer or something.

Traceback (most recent call last):
  File "/usr/lib/python3.7/asyncio/events.py", line 88, in _run
    self._context.run(self._callback, *self._args)
  File "/usr/lib/python3.7/asyncio/selector_events.py", line 975, in _read_ready
    self._protocol.datagram_received(data, addr)
  File "/opt/git/lbry-sdk/lbry/dht/protocol/protocol.py", line 564, in datagram_received
    self.handle_request_datagram(address, message)
  File "/opt/git/lbry-sdk/lbry/dht/protocol/protocol.py", line 455, in handle_request_datagram
    peer = make_kademlia_peer(request_datagram.node_id, address[0], address[1])
  File "/opt/git/lbry-sdk/lbry/dht/peer.py", line 20, in make_kademlia_peer
    return KademliaPeer(address, node_id, udp_port, tcp_port=tcp_port, allow_localhost=allow_localhost)
  File "<string>", line 9, in __init__
  File "/opt/git/lbry-sdk/lbry/dht/peer.py", line 163, in __post_init__
    raise ValueError(f"invalid ip address: '{self.address}'")
ValueError: invalid ip address: '192.168.1.8'