fix(weed/command) address unhandled errors (#9208)

* fix(weed/command) address unhandled errors

* fix(command): don't log graceful-shutdown sentinels; plug response-body leak

- s3: Serve on unix socket treated http.ErrServerClosed as fatal; now
  excluded like the other Serve/ServeTLS paths in this file.
- mq_agent, mq_broker: filter grpc.ErrServerStopped so clean shutdown
  doesn't log as an error.
- worker_runtime: the added decodeErr early-continue skipped
  resp.Body.Close(); drop it since the existing check below already
  surfaces the decode error.
- mount_std: the pre-mount Unmount commonly fails when nothing is
  mounted; demote to V(1) Infof.
- fuse_std: tidy panic message to match sibling cases.

* fix(mq_broker): filter grpc.ErrServerStopped on localhost listener

The localhost listener goroutine logged any Serve error unconditionally,
which includes grpc.ErrServerStopped on graceful shutdown. Match the
main listener's check so clean stops don't surface as errors.

---------

Co-authored-by: Chris Lu <chris.lu@gmail.com>
This commit is contained in:
Lars LehtonenandChris Lu authored and GitHub committed 2026-04-23 22:15:05 -07:00
1 parent 88c2f3c34d
commit 29e14f89f1
11 files changed
+67 -27

No files matched your search

+11 -5
View File
@@ -166,7 +166,9 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
return false
}
unmount.Unmount(dir)
if err := unmount.Unmount(dir); err != nil {
glog.V(1).Infof("pre-mount cleanup unmount %s: %v", dir, err)
}
// start on local unix socket
if *option.localSocket == "" {
@@ -186,7 +188,9 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
// detect mount folder mode
if *option.dirAutoCreate {
os.MkdirAll(dir, os.FileMode(0777)&^umask)
if err := os.MkdirAll(dir, os.FileMode(0777)&^umask); err != nil {
glog.Fatalf("failed to create directory %s:%v", dir, err)
}
}
fileInfo, err := os.Stat(dir)
@@ -357,8 +361,8 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
WritebackCache: option.writebackCache != nil && *option.writebackCache,
PosixDirNlink: option.posixDirNlink != nil && *option.posixDirNlink,
// Peer chunk sharing
PeerEnabled: option.peerEnabled != nil && *option.peerEnabled,
PeerListen: peerStringOrEmpty(option.peerListen),
PeerEnabled: option.peerEnabled != nil && *option.peerEnabled,
PeerListen: peerStringOrEmpty(option.peerListen),
PeerAdvertise: peerStringOrEmpty(option.peerAdvertise),
PeerDataCenter: peerStringOrEmpty(option.peerDataCenter),
PeerRack: peerStringOrEmpty(option.peerRack),
@@ -381,7 +385,9 @@ func RunMount(option *MountOptions, umask os.FileMode) bool {
glog.Fatalf("Mount fail: %v", err)
}
grace.OnInterrupt(func() {
unmount.Unmount(dir)
if err := unmount.Unmount(dir); err != nil {
glog.Errorf("failed to unmount %s: %v", dir, err)
}
})
if mountOptions.fuseCommandPid != 0 {