mirror of
https://github.com/sigp/lighthouse.git
synced 2026-03-06 10:11:44 +00:00
fix(validator_client): raise soft fd limit (#4796)
* fix(validator_client): raise soft fd limit * Merge branch 'unstable' of https://github.com/sigp/lighthouse into rkrasiuk/raise-vc-fdlimit * cargo lock * Merge branch 'unstable' of https://github.com/sigp/lighthouse into rkrasiuk/raise-vc-fdlimit
This commit is contained in:
@@ -47,7 +47,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;
|
||||
@@ -121,6 +121,27 @@ impl<E: EthSpec> ProductionValidatorClient<E> {
|
||||
pub async fn new(context: RuntimeContext<E>, 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
|
||||
match fdlimit::raise_fd_limit().map_err(|e| format!("Unable to raise fd limit: {}", e))? {
|
||||
fdlimit::Outcome::LimitRaised { from, to } => {
|
||||
debug!(
|
||||
log,
|
||||
"Raised soft open file descriptor resource limit";
|
||||
"old_limit" => from,
|
||||
"new_limit" => to
|
||||
);
|
||||
}
|
||||
fdlimit::Outcome::Unsupported => {
|
||||
debug!(
|
||||
log,
|
||||
"Raising soft open file descriptor resource limit is not supported"
|
||||
);
|
||||
}
|
||||
};
|
||||
|
||||
info!(
|
||||
log,
|
||||
"Starting validator client";
|
||||
|
||||
Reference in New Issue
Block a user