Skip to content

Commit

Permalink
Remove panic after graceful shutdown
Browse files Browse the repository at this point in the history
remote-apis-testing shows the following log in
https://gitlab.com/remote-apis-testing/remote-apis-testing/-/jobs/2773967861

2022/07/26 20:20:14 Received terminated signal. Initiating graceful shutdown.
2022/07/26 20:20:14 Graceful shutdown complete
panic: Raising the original signal didn't cause us to shut down

Apparently, the panic line was reached before the signal had been
handled and the process killed, probably due to a different thread is
receiving the signal. For more details, see
golang/go#19326
  • Loading branch information
moroten committed Aug 1, 2022
1 parent a575837 commit 2760ada
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion pkg/global/graceful_termination_handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,10 @@ func InstallGracefulTerminationHandler() (context.Context, *errgroup.Group) {
if err := process.Signal(receivedSignal); err != nil {
panic(err)
}
panic("Raising the original signal didn't cause us to shut down")
// This code should not be reached, if it weren't for the
// fact that process.Signal() does not guarantee that the
// signal is delivered to the same thread.
// More details: https://github.com/golang/go/issues/19326
}()

return ctx, &group
Expand Down

0 comments on commit 2760ada

Please sign in to comment.