Skip to content

SeaweedFS is a distributed storage system for object storage (S3), file systems, Iceberg table buckets, and Lance vector buckets, designed to handle billions of files with O(1) disk access and effortless horizontal scaling.

[filer] DATA RACE on signal_handling fixed (#3575)

Konstantin Lebedev853880bd837b
diff --git a/weed/util/grace/signal_handling.go b/weed/util/grace/signal_handling.go
index fc7afcad9d..8146668be5 100644
--- a/weed/util/grace/signal_handling.go
+++ b/weed/util/grace/signal_handling.go
@@ -12,7 +12,7 @@ import (
var signalChan chan os.Signal
var hooks = make([]func(), 0)
-var hookLock sync.Mutex
+var hookLock sync.RWMutex
func init() {
signalChan = make(chan os.Signal, 1)
@@ -27,10 +27,12 @@ func init() {
// syscall.SIGQUIT,
)
go func() {
- for _ = range signalChan {
+ for range signalChan {
+ hookLock.RLock()
for _, hook := range hooks {
hook()
}
+ hookLock.RUnlock()
os.Exit(0)
}
}()