zebra icon indicating copy to clipboard operation
zebra copied to clipboard

Return errors from `Connection` methods to the `Client`

Open teor2345 opened this issue 2 years ago • 1 comments

Motivation

We're seeing "failed servers must set their error slot" panics when Zebra is overloaded.

This panic is caused by the design of the Client connection code. Currently, the Client tasks share an ErrorSlot mutex, which must be updated before they exit.

This ticket stops using the error slot in the Connection task.

Designs

Instead of using the error slot, Client tasks should exit and return an error to the client instance. The Client should exit when any task errors or stops.

We could try something like this: (click for details)

Replace Connection.error_slot with returning a PeerError:

  • when there is an unrecoverable error, return an error from the current Connection method
  • propagate those errors up to Connection::run
  • break from the run loop, call shutdown, then return the error
  • check the error via the JoinHandle in the Client

Related Work

This is part of:

  • #3263

teor2345 avatar Jul 04 '22 02:07 teor2345

We're lowering the priority of network issues at the moment.

teor2345 avatar Aug 14 '22 21:08 teor2345