Merge pull request #16009 from holiman/db_handles

cmd/utils: fix #16006 by not lowering OS ulimit
This commit is contained in:
Péter Szilágyi 2018-02-04 01:05:32 +02:00 committed by GitHub
commit 0662384d29
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -714,13 +714,15 @@ func setIPC(ctx *cli.Context, cfg *node.Config) {
// makeDatabaseHandles raises out the number of allowed file handles per process
// for Geth and returns half of the allowance to assign to the database.
func makeDatabaseHandles() int {
if err := fdlimit.Raise(2048); err != nil {
Fatalf("Failed to raise file descriptor allowance: %v", err)
}
limit, err := fdlimit.Current()
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
}