neofs-node
neofs-node copied to clipboard
Graceful shutdown if metrics/pprof/control service is not available
Is your feature request related to a problem? Please describe.
If some bad happens in http.Serve
we just die instantly: here, here and here. These services are kinda the most important for us (they allows us understanding if the other services work in general and making decisions based on statistic information) but not that important to kill application on any error like os.Exit(1)
.
Describe the solution you'd like
Find out a better way to handle these errors e.g. canceling app context and waiting for other services to shutdown.
Describe alternatives you've considered
Do nothing, it works almost all the time ok.
Additional context
After https://github.com/nspcc-dev/neofs-node/issues/2585, https://github.com/nspcc-dev/neofs-node/issues/2428 and similar things, canceling context may become not the best way to do it: metrics will be the first thing to run and if they die, other services may not be inited yet (and initialization sometimes take its time and no Init
takes context.Context
), so no shutdown will be performed until all the Init
is done.