From a5935486ef4da7b669ec686fbd76fa0a72aa5e82 Mon Sep 17 00:00:00 2001 From: whyrusleeping Date: Wed, 1 Jul 2020 17:09:21 -0700 Subject: [PATCH] have lotus attempt to raise its own file descriptor limit --- cmd/lotus/daemon.go | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/cmd/lotus/daemon.go b/cmd/lotus/daemon.go index 912e65253..bb17c0d87 100644 --- a/cmd/lotus/daemon.go +++ b/cmd/lotus/daemon.go @@ -32,6 +32,7 @@ import ( "github.com/filecoin-project/lotus/chain/vm" lcli "github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/lib/peermgr" + "github.com/filecoin-project/lotus/lib/ulimit" "github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node/modules" @@ -113,6 +114,11 @@ var DaemonCmd = &cli.Command{ Name: "profile", Usage: "specify type of node", }, + &cli.BoolFlag{ + Name: "manage-fdlimit", + Usage: "manage open file limit", + Value: true, + }, }, Action: func(cctx *cli.Context) error { err := runmetrics.Enable(runmetrics.RunMetricOptions{ @@ -122,6 +128,13 @@ var DaemonCmd = &cli.Command{ if err != nil { return xerrors.Errorf("enabling runtime metrics: %w", err) } + + if cctx.Bool("manage-fdlimit") { + if _, _, err := ulimit.ManageFdLimit(); err != nil { + log.Errorf("setting file descriptor limit: %s", err) + } + } + if prof := cctx.String("pprof"); prof != "" { profile, err := os.Create(prof) if err != nil {