-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Raise Soft File Descriptor Limit Up To The Hard Limit #10650
Merged
Merged
Changes from all commits
Commits
Show all changes
17 commits
Select commit
Hold shift + click to select a range
e83dacf
add changes
nisdas f6d80fe
comment
nisdas 70eef8e
Merge branch 'develop' into addLimits
nisdas a1e592f
Merge branch 'develop' of https://github.com/prysmaticlabs/geth-shard…
nisdas 60c4b1c
kasey's review
nisdas 93e1a00
Merge branch 'develop' into addLimits
nisdas 853d4e6
Merge branch 'develop' into addLimits
nisdas 07da321
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 9e18e4a
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 6767b6b
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 40b0acf
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 5f925fe
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 9201ccf
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 7a4b8d7
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] b665508
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 1625fe6
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] 2501820
Merge refs/heads/develop into addLimits
prylabs-bulldozer[bot] File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
load("@prysm//tools/go:def.bzl", "go_library", "go_test") | ||
|
||
go_library( | ||
name = "go_default_library", | ||
srcs = ["fdlimits.go"], | ||
importpath = "github.com/prysmaticlabs/prysm/runtime/fdlimits", | ||
visibility = ["//visibility:public"], | ||
deps = [ | ||
"@com_github_ethereum_go_ethereum//common/fdlimit:go_default_library", | ||
"@com_github_sirupsen_logrus//:go_default_library", | ||
], | ||
) | ||
|
||
go_test( | ||
name = "go_default_test", | ||
srcs = ["fdlimits_test.go"], | ||
deps = [ | ||
":go_default_library", | ||
"//testing/assert:go_default_library", | ||
"@com_github_ethereum_go_ethereum//common/fdlimit:go_default_library", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
package fdlimits | ||
|
||
import ( | ||
"github.com/ethereum/go-ethereum/common/fdlimit" | ||
log "github.com/sirupsen/logrus" | ||
) | ||
|
||
// SetMaxFdLimits is a wrapper around a few go-ethereum methods to allow prysm to | ||
// set its file descriptor limits at the maximum possible value. | ||
func SetMaxFdLimits() error { | ||
curr, err := fdlimit.Current() | ||
if err != nil { | ||
return err | ||
} | ||
max, err := fdlimit.Maximum() | ||
if err != nil { | ||
return err | ||
} | ||
raisedVal, err := fdlimit.Raise(uint64(max)) | ||
if err != nil { | ||
return err | ||
} | ||
log.Infof("Raised fd limit to %d from %d", raisedVal, curr) | ||
return nil | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
package fdlimits_test | ||
|
||
import ( | ||
"testing" | ||
|
||
gethLimit "github.com/ethereum/go-ethereum/common/fdlimit" | ||
"github.com/prysmaticlabs/prysm/runtime/fdlimits" | ||
"github.com/prysmaticlabs/prysm/testing/assert" | ||
) | ||
|
||
func TestSetMaxFdLimits(t *testing.T) { | ||
assert.NoError(t, fdlimits.SetMaxFdLimits()) | ||
|
||
curr, err := gethLimit.Current() | ||
assert.NoError(t, err) | ||
|
||
max, err := gethLimit.Maximum() | ||
assert.NoError(t, err) | ||
|
||
assert.Equal(t, max, curr, "current and maximum file descriptor limits do not match up.") | ||
|
||
} |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I see no downside to doing this by default, so 👍. I looked at the go-ethereum lib because I was curious why we were adding this dependency on them. It looks like the benefit here is that they have the major os-specific variants set up with appropriate build tags, so that we can have this simple
Raise(Maximum())
code (including eg Windows where the raise is a no-op). seems fine.