mirror of
https://github.com/seaweedfs/seaweedfs.git
synced 2026-10-10 00:07:44 +02:00
fix: prevent deadlock when stream error occurs - make cmds send non-blocking
If managerLoop is blocked (e.g., waiting on regWait), a blocking send to cmds will deadlock handleIncoming. Make the send non-blocking to prevent this.
This commit is contained in:
1 parent
85369414f9
commit
3ebbd25a4b
1 file changed
+6
-2
@@ -446,8 +446,12 @@ func handleIncoming(
|
|||||||
default:
|
default:
|
||||||
}
|
}
|
||||||
|
|
||||||
// Report the failure as a command to the managerLoop (blocking)
|
// Report the failure as a command to the managerLoop (non-blocking to prevent deadlock)
|
||||||
cmds <- grpcCommand{action: ActionStreamError, data: err}
|
select {
|
||||||
|
case cmds <- grpcCommand{action: ActionStreamError, data: err}:
|
||||||
|
default:
|
||||||
|
glog.V(2).Infof("Manager busy, stream error not queued: %v", err)
|
||||||
|
}
|
||||||
|
|
||||||
// Exit the main handler loop
|
// Exit the main handler loop
|
||||||
glog.V(1).Infof("INCOMING HANDLER STOPPED: Worker %s stopping incoming handler due to stream error", workerID)
|
glog.V(1).Infof("INCOMING HANDLER STOPPED: Worker %s stopping incoming handler due to stream error", workerID)
|
||||||
|
|||||||
Reference in new issue
Block a user