Skip to content

Commit d2328b6

Browse files
authored
Merge pull request #18211 from karalabe/drop-fd-limit
cmd/utils: max out the OS file allowance, don't cap to 2K
2 parents 6618097 + cf62bd2 commit d2328b6

File tree

1 file changed

+3
-8
lines changed

1 file changed

+3
-8
lines changed

cmd/utils/flags.go

Lines changed: 3 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -824,17 +824,12 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
824824
// makeDatabaseHandles raises out the number of allowed file handles per process
825825
// for Geth and returns half of the allowance to assign to the database.
826826
func makeDatabaseHandles() int {
827-
limit, err := fdlimit.Current()
827+
limit, err := fdlimit.Maximum()
828828
if err != nil {
829829
Fatalf("Failed to retrieve file descriptor allowance: %v", err)
830830
}
831-
if limit < 2048 {
832-
if err := fdlimit.Raise(2048); err != nil {
833-
Fatalf("Failed to raise file descriptor allowance: %v", err)
834-
}
835-
}
836-
if limit > 2048 { // cap database file descriptors even if more is available
837-
limit = 2048
831+
if err := fdlimit.Raise(uint64(limit)); err != nil {
832+
Fatalf("Failed to raise file descriptor allowance: %v", err)
838833
}
839834
return limit / 2 // Leave half for networking and other stuff
840835
}

0 commit comments

Comments
 (0)