Compare commits

...

1 commit

Author SHA1 Message Date
484836b9f9 [#878] node: Drain internal error's channel
All checks were successful
DCO action / DCO (pull_request) Successful in 3m33s
Vulncheck / Vulncheck (pull_request) Successful in 4m24s
Tests and linters / Staticcheck (pull_request) Successful in 7m6s
Build / Build Components (1.21) (pull_request) Successful in 8m5s
Build / Build Components (1.20) (pull_request) Successful in 8m12s
Tests and linters / Lint (pull_request) Successful in 12m2s
Tests and linters / Tests (1.20) (pull_request) Successful in 15m5s
Tests and linters / Tests (1.21) (pull_request) Successful in 15m43s
Tests and linters / Tests with -race (pull_request) Successful in 16m27s
This fixes shutdown panic:
1. Some morph connection gets error and passes it to internalErr channel.
2. Storage node starts to shutdow and closes internalErr channel.
3. Other morph connection gets error and tries to pass it to internalErr channel.

Signed-off-by: Dmitrii Stepanov <d.stepanov@yadro.com>
2023-12-19 08:24:17 +03:00
2 changed files with 14 additions and 1 deletions

View file

@ -1325,5 +1325,4 @@ func (c *cfg) shutdown() {
for i := range c.closers {
c.closers[len(c.closers)-1-i].fn()
}
close(c.internalErr)
}

View file

@ -6,6 +6,7 @@ import (
"fmt"
"log"
"os"
"sync"
"git.frostfs.info/TrueCloudLab/frostfs-node/cmd/frostfs-node/config"
"git.frostfs.info/TrueCloudLab/frostfs-node/internal/logs"
@ -155,9 +156,22 @@ func wait(c *cfg) {
<-c.done // graceful shutdown
drain := &sync.WaitGroup{}
drain.Add(1)
go func() {
defer drain.Done()
for err := range c.internalErr {
c.log.Warn(logs.FrostFSNodeInternalApplicationError,
zap.String("message", err.Error()))
}
}()
c.log.Debug(logs.FrostFSNodeWaitingForAllProcessesToStop)
c.wg.Wait()
close(c.internalErr)
drain.Wait()
}
func (c *cfg) onShutdown(f func()) {