aboutsummaryrefslogtreecommitdiff
path: root/weed/command/filer_cat.go
diff options
context:
space:
mode:
authorchrislu <chris.lu@gmail.com>2022-02-07 23:08:54 -0800
committerchrislu <chris.lu@gmail.com>2022-02-07 23:08:54 -0800
commit85c1615b435c4d7fb87b30fbe6cde4599d555b62 (patch)
tree45aba53786b2d71d6668d559c09aa6d22632f80a /weed/command/filer_cat.go
parentb1cff07ab0541200b26d345d1d396fddcba66d79 (diff)
downloadseaweedfs-85c1615b435c4d7fb87b30fbe6cde4599d555b62.tar.xz
seaweedfs-85c1615b435c4d7fb87b30fbe6cde4599d555b62.zip
filer read empty file may cause OOM in some cases
fix https://github.com/chrislusf/seaweedfs/issues/2641
Diffstat (limited to 'weed/command/filer_cat.go')
-rw-r--r--weed/command/filer_cat.go3
1 files changed, 1 insertions, 2 deletions
diff --git a/weed/command/filer_cat.go b/weed/command/filer_cat.go
index 7f613f72b..ada843dea 100644
--- a/weed/command/filer_cat.go
+++ b/weed/command/filer_cat.go
@@ -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)))
})