filer read empty file may cause OOM in some cases

fix https://github.com/chrislusf/seaweedfs/issues/2641
This commit is contained in:
chrislu
2022-02-07 23:08:54 -08:00
parent b1cff07ab0
commit 85c1615b43
5 changed files with 10 additions and 16 deletions

View File

@@ -8,7 +8,6 @@ import (
"github.com/chrislusf/seaweedfs/weed/pb/filer_pb"
"github.com/chrislusf/seaweedfs/weed/wdclient"
"google.golang.org/grpc"
"math"
"net/url"
"os"
"strings"
@@ -115,7 +114,7 @@ func runFilerCat(cmd *Command, args []string) bool {
filerCat.filerClient = client
return filer.StreamContent(&filerCat, writer, respLookupEntry.Entry.Chunks, 0, math.MaxInt64)
return filer.StreamContent(&filerCat, writer, respLookupEntry.Entry.Chunks, 0, int64(filer.FileSize(respLookupEntry.Entry)))
})