Skip to content

Conversation

lexnv
Copy link
Collaborator

@lexnv lexnv commented Sep 23, 2025

This PR ensures that both TCP and WebSocket transports do not terminate in case of listener errors.

Recoverable errors like ConnectionAborted (which signals that the client connection entered the queue and disconnected before we got a chance to process it) are retried.

Nonrecoverable errors lead to the TokioListener being dropped and never polled again (ie, removed from the transport service).

TCP and Websocket are now robust wrt listener errors and will not terminate the main execution loop unless the listeners return None.

Closes: #437
cc @paritytech/networking

Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
Signed-off-by: Alexandru Vasile <alexandru.vasile@parity.io>
@lexnv lexnv self-assigned this Sep 23, 2025
@lexnv lexnv added this to Networking Sep 23, 2025
return Poll::Ready(Some(Ok((stream, address))));
}
Poll::Ready(Err(error)) => match error.kind() {
ErrorKind::ConnectionAborted | ErrorKind::ConnectionReset => {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I would double check that socket.accept() can't generate these errors continuously after a socket error — otherwise we would end up busy-looping here.

?error,
"Fatal error for listener",
);
self.listeners[current] = None;
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IMO a better way would be to terminate the process and let the restarted process listen again, than stopping accepting incoming connections completely.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

Successfully merging this pull request may close these issues.

tcp: Listener terminated with error causing litep2p backend to exit
2 participants