Skip to content

transport: Failed addresses are not reported back on a successful connection #526

@lexnv

Description

@lexnv

The TCP transport layer takes 8 addresses to dial. If 1 is successful and 7 are unreachable, the 7 errors are not propagated back to the transport manager.

The downstream effect is that the address scores of the 7 unreachable addresses are not updated. This then leaves the 7 known unreachable addresses to be considered as reachable to the next "Dial attempt".

In passeo, this has been observed on a validator wrongly configured with 31 addresses:

  • only one of the 31 addresses are reachable
  • if the good address is picked, the rest 7 that would fail are ignored

The TransportEvent::ConnectionOpened needs to take into account the errors generated during dialing:

RawConnectionResult::Connected { negotiated, errors } => {
let Some(handle) = self.cancel_futures.remove(&negotiated.connection_id())
else {
tracing::warn!(
target: LOG_TARGET,
connection_id = ?negotiated.connection_id(),
address = ?negotiated.endpoint().address(),
?errors,
"raw connection without a cancel handle",
);
continue;
};
if !handle.is_aborted() {
let connection_id = negotiated.connection_id();
let address = negotiated.endpoint().address().clone();
self.opened.insert(connection_id, negotiated);
return Poll::Ready(Some(TransportEvent::ConnectionOpened {
connection_id,
address,
}));

Part of:

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions