ethereum/trinity

MalformedMessage exception escaping during handshake

pipermerriam opened this issue · 1 comments

What is wrong?

   ERROR  2020-08-31 21:58:08,893            FullServer  Unexpected error handling handshake with ('91.58.153.34', 45026)
Traceback (most recent call last):
  File "/root/trinity/p2p/transport.py", line 264, in recv
    header_data = _decode_header_data(padded_header[3:])
  File "/root/trinity/p2p/transport.py", line 59, in _decode_header_data
    header_data = rlp.decode(data, sedes=HEADER_DATA_SEDES, strict=False)
  File "/root/env/lib/python3.8/site-packages/rlp/codec.py", line 237, in decode
    obj = sedes.deserialize(item, **kwargs)
  File "/root/env/lib/python3.8/site-packages/eth_utils/functional.py", line 45, in inner
    return callback(fn(*args, **kwargs))
  File "/root/env/lib/python3.8/site-packages/rlp/sedes/lists.py", line 86, in deserialize
    raise ListDeserializationError(
rlp.exceptions.ListDeserializationError: Deserializing list length (1) does not match sedes (2)
The above exception was the direct cause of the following exception:
Traceback (most recent call last):
  File "/root/trinity/trinity/server.py", line 132, in receive_handshake
    await self._receive_handshake(reader, writer)
  File "/root/trinity/trinity/server.py", line 152, in _receive_handshake
    connection = await receive_dial_in(
  File "/root/trinity/p2p/handshake.py", line 371, in receive_dial_in
    multiplexer, devp2p_receipt, protocol_receipts = await negotiate_protocol_handshakes(
  File "/root/trinity/p2p/handshake.py", line 229, in negotiate_protocol_handshakes
    devp2p_receipt, base_protocol = await _do_p2p_handshake(
  File "/root/trinity/p2p/handshake.py", line 138, in _do_p2p_handshake
    async for _, cmd in stream_transport_messages(transport, base_protocol):
  File "/root/trinity/p2p/multiplexer.py", line 62, in stream_transport_messages
    msg = await transport.recv()
  File "/root/trinity/p2p/transport.py", line 266, in recv
    raise MalformedMessage(*err.args) from err
p2p.exceptions.MalformedMessage: Deserializing list length (1) does not match sedes (2)

How can it be fixed

Looks like a simple case of missing exception handling.

Closing as #2052 has more info