Skip to content
This repository was archived by the owner on Oct 28, 2021. It is now read-only.
This repository was archived by the owner on Oct 28, 2021. It is now read-only.

Exception thrown during syncing: Throw in function class dev::eth::EthereumPeer &__cdecl dev::eth::EthereumCapability::peer(const class dev::FixedHash<64> &) #5835

@halfalicious

Description

@halfalicious

Exceptions can be thrown during syncing if a peer reconnects while there's a pending disconnect - there will be a live Session (entry in Host::m_sessions which is still alive and isConnected) but no entry for the node in EthereumCapability::m_peers, so if the peer sends us an eth capability packet, or if something happens which triggers us to continue syncing (BlockChainSync::continueSync) e.g. a node (other than the one which reconnected during the pending disconnect) initiates a disconnect, we will try to lookup the peer in m_peers and not find it and throw here:

EthereumPeer& EthereumCapability::peer(NodeID const& _peerID)
{
auto peer = m_peers.find(_peerID);
if (peer == m_peers.end())
BOOST_THROW_EXCEPTION(PeerDisconnected() << errinfo_nodeID(_peerID));
return peer->second;
}

Please see here for a detailed description of this scenario.

The exception that we will see when a node disconnects (other than the one which reconnected during a pending disconnect) is:

WARN  11-05 09:55:39 p2p  warn   Exception on peer destruction: C:\Users\nilse\Documents\Code\aleth_ref\libethereum\EthereumCapability.cpp(1008): Throw in function class dev::eth::EthereumPeer &__cdecl dev::eth::EthereumCapability::peer(const class dev::FixedHash<64> &)
Dynamic exception type: struct boost::wrapexcept<struct dev::eth::PeerDisconnected>
[struct dev::tag_nodeID * __ptr64] = e5a7df63cde56b0a33b14de356dcae10cc8a7e3ec18a3749bc51c3566fbad09467980ebd4e4fc8610152781a7832a61539a2267da09d781871cb33dc54af65da

The exception that we will see when we receive a capability packet from the node which reconnected during a pending disconnect is:

WARN  11-05 09:55:35 p2p  ethcap Peer ##9b2af51d… causing an exception: C:\Users\nilse\Documents\Code\aleth_ref\libethereum\EthereumCapability.cpp(1008): Throw in function class dev::eth::EthereumPeer &__cdecl dev::eth::EthereumCapability::peer(const class dev::FixedHash<64> &)
Dynamic exception type: struct boost::wrapexcept<struct dev::eth::PeerDisconnected>
[struct dev::tag_nodeID * __ptr64] = e5a7df63cde56b0a33b14de356dcae10cc8a7e3ec18a3749bc51c3566fbad09467980ebd4e4fc8610152781a7832a61539a2267da09d781871cb33dc54af65da
 [ [ 0xA218E2C611F21232D857E3C8CECDCDF1F65F25A4477F98F6F47E4063807F2308, 0x1DCC4DE8DEC75D7AAB85B567B6CCD41AD312451B948A7413F0A142FD40D49347, 0xBCDFC35B86BEDF72F0CDA046A3C16829A2EF41D1, 0xC5E389416116E3696CCE82EC4533CCE33EFCCB24CE245AE9546A4B8F0D5E9A75, 0x7701DF8E07169452554D14AADD7BFA256D4A1D0355C1D174AB373E3E2D0A3743, 0x26CF9D9422E9DD95AEDC7914DB690B92BAB6902F5221D62694A2FA5D065F534B, "\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00", 0x38C3BF2616AA, 0x1D4C00, 0x47E7C0, 0x14820, 0x578F7AA8, 0x64616F2D686172642D666F726B, 0x5B5ACBF4BF305F948BD7BE176047B20623E1417F75597341A059729165B92397, 0xBEDE87201DE42426 ] ]

Metadata

Metadata

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions