Skip to content

Commit

Permalink
node/pprof,metrics: make them stop at the end of app life
Browse files Browse the repository at this point in the history
Like 85b31b9 but for shutdown order. In
practice, there was an SN app that could not stop, but it was impossible to
debug anything because no pprof or metrics were available. Closes #2976.

Signed-off-by: Pavel Karpy <[email protected]>
  • Loading branch information
carpawell committed Oct 22, 2024
1 parent c71e780 commit b8a7709
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 1 deletion.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ notes) if you've not done it previously.
- `ObjectService`'s `Search` and `Replicate` RPC handlers cache up to 1000 lists of container nodes (#2892)
- Default max_traceable_blocks Morph setting lowered to 17280 from 2102400 (#2897)
- `ObjectService`'s `Get`/`Head`/`GetRange` RPC handlers cache up to 10K lists of per-object sorted container nodes (#2896)
- Pprof and metrics services stop at the end of SN's application lifecycle (#2976)

### Updated
- neofs-contract dependency to 0.20.0 (#2872)
Expand Down
3 changes: 3 additions & 0 deletions cmd/neofs-node/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -285,6 +285,9 @@ type internals struct {
wg *sync.WaitGroup
workers []worker
closers []func()
// services that are useful for debug (e.g. when a regular closer does not
// close), must be close at the very end of application life cycle
veryLastClosers []func()

apiVersion version.Version
healthStatus atomic.Int32
Expand Down
5 changes: 4 additions & 1 deletion cmd/neofs-node/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func preRunAndLog(c *cfg, name string, srv *httputil.Server) {
})
}()

c.closers = append(c.closers, func() {
c.closers = append(c.veryLastClosers, func() {

Check warning on line 100 in cmd/neofs-node/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/main.go#L100

Added line #L100 was not covered by tests
c.log.Debug(fmt.Sprintf("shutting down %s service", name))

err := srv.Shutdown()
Expand Down Expand Up @@ -185,6 +185,9 @@ func shutdown(c *cfg) {
for _, closer := range c.closers {
closer()
}
for _, lastCloser := range c.veryLastClosers {
lastCloser()
}

Check warning on line 190 in cmd/neofs-node/main.go

View check run for this annotation

Codecov / codecov/patch

cmd/neofs-node/main.go#L188-L190

Added lines #L188 - L190 were not covered by tests

c.log.Debug("waiting for all processes to stop")

Expand Down

0 comments on commit b8a7709

Please sign in to comment.