mirror of
https://github.com/minio/minio.git
synced 2025-11-07 12:52:58 -05:00
Mux: Send async mux ack and fix stream error responses (#19149)
Streams can return errors if the cancelation is picked up before the response stream close is picked up. Under extreme load, this could lead to missing responses. Send server mux ack async so a blocked send cannot block newMuxStream call. Stream will not progress until mux has been acked.
This commit is contained in:
@@ -74,10 +74,15 @@ func (s *Stream) Results(next func(b []byte) error) (err error) {
|
||||
}
|
||||
}
|
||||
}()
|
||||
doneCh := s.ctx.Done()
|
||||
for {
|
||||
select {
|
||||
case <-s.ctx.Done():
|
||||
return context.Cause(s.ctx)
|
||||
case <-doneCh:
|
||||
if err := context.Cause(s.ctx); !errors.Is(err, errStreamEOF) {
|
||||
return err
|
||||
}
|
||||
// Fall through to be sure we have returned all responses.
|
||||
doneCh = nil
|
||||
case resp, ok := <-s.responses:
|
||||
if !ok {
|
||||
done = true
|
||||
|
||||
Reference in New Issue
Block a user