Skip to content

Commit

Permalink
bridge: propagate panics from runnables
Browse files Browse the repository at this point in the history
Any error that can be recovered by restarting a runnable
can also be recovered from by restarting the entire process.

If we encounter a panic, it's safer to restart the process than
attempting to limp along by restarting the runnable.

We always assume that an external process manager will restart
our process if it crashes. We already rely on this behavior for
libp2p errors which we handle by terminating the process, since libp2p
maintains global state that we can't clear.

ghstack-source-id: 2f20ef764d32ffca16fb22055a85772e490616e7
Pull Request resolved: #45
  • Loading branch information
Leo committed Oct 22, 2020
1 parent c698d4e commit 3b35ddc
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion bridge/cmd/guardiand/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,10 @@ func main() {
case <-ctx.Done():
return nil
}
})
},
// It's safer to crash and restart the process in case we encounter a panic,
// rather than attempting to reschedule the runnable.
supervisor.WithPropagatePanic)

select {
case <-rootCtx.Done():
Expand Down

0 comments on commit 3b35ddc

Please sign in to comment.