mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
avoid close 'nil' panics if any (#18890)
brings a generic implementation that prints a stack trace for 'nil' channel closes(), if not safely closes it.
This commit is contained in:
@@ -23,6 +23,8 @@ import (
|
||||
"os/exec"
|
||||
"runtime"
|
||||
"syscall"
|
||||
|
||||
xioutil "github.com/minio/minio/internal/ioutil"
|
||||
)
|
||||
|
||||
// Type of service signals currently supported.
|
||||
@@ -109,7 +111,7 @@ func unfreezeServices() {
|
||||
if val := globalServiceFreeze.Swap(_ch); val != nil {
|
||||
if ch, ok := val.(chan struct{}); ok && ch != nil {
|
||||
// Close previous non-nil channel.
|
||||
close(ch)
|
||||
xioutil.SafeClose(ch)
|
||||
}
|
||||
}
|
||||
globalServiceFreezeCnt = 0 // Don't risk going negative.
|
||||
|
||||
Reference in New Issue
Block a user