mirror of
https://github.com/minio/minio.git
synced 2025-01-23 12:43:16 -05:00
Disable DMA optimization on windows (#18575)
It appears that Windows can lock up when errors occur. Use regular copy here.
This commit is contained in:
parent
c397fb6c7a
commit
69294cf98a
@ -29,6 +29,7 @@ import (
|
||||
"net/http"
|
||||
"os/user"
|
||||
"path"
|
||||
"runtime"
|
||||
"runtime/debug"
|
||||
"strconv"
|
||||
"strings"
|
||||
@ -641,9 +642,10 @@ func (s *storageRESTServer) ReadFileStreamHandler(w http.ResponseWriter, r *http
|
||||
defer rc.Close()
|
||||
|
||||
rf, ok := w.(io.ReaderFrom)
|
||||
if ok {
|
||||
if ok && runtime.GOOS != "windows" {
|
||||
// Attempt to use splice/sendfile() optimization, A very specific behavior mentioned below is necessary.
|
||||
// See https://github.com/golang/go/blob/f7c5cbb82087c55aa82081e931e0142783700ce8/src/net/sendfile_linux.go#L20
|
||||
// Windows can lock up with this optimization, so we fall back to regular copy.
|
||||
dr, ok := rc.(*xioutil.DeadlineReader)
|
||||
if ok {
|
||||
sr, ok := dr.ReadCloser.(*sendFileReader)
|
||||
|
@ -80,7 +80,9 @@ var ErrNotImplemented = errors.New("not implemented")
|
||||
// returns an error if the underlying ResponseWriter does not implement io.ReaderFrom
|
||||
func (lrw *ResponseRecorder) ReadFrom(r io.Reader) (int64, error) {
|
||||
if lrw.ReaderFrom != nil {
|
||||
return lrw.ReaderFrom.ReadFrom(r)
|
||||
n, err := lrw.ReaderFrom.ReadFrom(r)
|
||||
lrw.bytesWritten += int(n)
|
||||
return n, err
|
||||
}
|
||||
return 0, ErrNotImplemented
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user