Skip to content

Commit

Permalink
fix(validator_client): raise soft fd limit
Browse files Browse the repository at this point in the history
  • Loading branch information
rkrasiuk committed Sep 30, 2023
1 parent 441fc16 commit d689d0a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 1 deletion.
10 changes: 10 additions & 0 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions validator_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,4 @@ malloc_utils = { workspace = true }
sysinfo = { workspace = true }
system_health = { path = "../common/system_health" }
logging = { workspace = true }
fdlimit = "0.2.1"
14 changes: 13 additions & 1 deletion validator_client/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ use notifier::spawn_notifier;
use parking_lot::RwLock;
use preparation_service::{PreparationService, PreparationServiceBuilder};
use reqwest::Certificate;
use slog::{error, info, warn, Logger};
use slog::{debug, error, info, warn, Logger};
use slot_clock::SlotClock;
use slot_clock::SystemTimeSlotClock;
use std::fs::File;
Expand Down Expand Up @@ -120,6 +120,18 @@ impl<T: EthSpec> ProductionValidatorClient<T> {
pub async fn new(context: RuntimeContext<T>, config: Config) -> Result<Self, String> {
let log = context.log().clone();

// Attempt to raise soft fd limit. The behavior is OS specific:
// `linux` - raise soft fd limit to hard
// `macos` - raise soft fd limit to `min(kernel limit, hard fd limit)`
// `windows` & rest - noop
if let Some(limit) = fdlimit::raise_fd_limit() {
debug!(
log,
"Raised soft open file descriptor resource limit";
"new_limit" => limit
);
}

info!(
log,
"Starting validator client";
Expand Down

0 comments on commit d689d0a

Please sign in to comment.