From aa5c4795d4ba01a48bf5ec3b351fe8fc8bbc0f3c Mon Sep 17 00:00:00 2001 From: Daniel Liu Date: Wed, 10 Jul 2024 09:14:46 +0800 Subject: [PATCH] cmd/utils: max out the OS file allowance, don't cap to 2K (#18211) --- cmd/utils/flags.go | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/cmd/utils/flags.go b/cmd/utils/flags.go index a9fd25c4922a..25f406683a0e 100644 --- a/cmd/utils/flags.go +++ b/cmd/utils/flags.go @@ -802,17 +802,12 @@ func setPrefix(ctx *cli.Context, cfg *node.Config) { // MakeDatabaseHandles raises out the number of allowed file handles per process // for XDC and returns half of the allowance to assign to the database. func MakeDatabaseHandles() int { - limit, err := fdlimit.Current() + limit, err := fdlimit.Maximum() if err != nil { Fatalf("Failed to retrieve file descriptor allowance: %v", err) } - if limit < 2048 { - if err := fdlimit.Raise(2048); err != nil { - Fatalf("Failed to raise file descriptor allowance: %v", err) - } - } - if limit > 2048 { // cap database file descriptors even if more is available - limit = 2048 + if err := fdlimit.Raise(uint64(limit)); err != nil { + Fatalf("Failed to raise file descriptor allowance: %v", err) } return limit / 2 // Leave half for networking and other stuff }