feat: raise fd limit of the binary (#668)

* raise fd limit of the binary

* Remove tracing and return error

* Ignore errors
This commit is contained in:
Sanket Shanbhag
2023-01-01 17:19:00 +05:30
committed by GitHub
parent 1f6a9436ac
commit 20847845e2
3 changed files with 16 additions and 0 deletions

10
Cargo.lock generated
View File

@ -1437,6 +1437,15 @@ dependencies = [
"instant", "instant",
] ]
[[package]]
name = "fdlimit"
version = "0.2.1"
source = "registry+https://github.com/rust-lang/crates.io-index"
checksum = "2c4c9e43643f5a3be4ca5b67d26b98031ff9db6806c3440ae32e02e3ceac3f1b"
dependencies = [
"libc",
]
[[package]] [[package]]
name = "ff" name = "ff"
version = "0.12.1" version = "0.12.1"
@ -3415,6 +3424,7 @@ dependencies = [
"confy", "confy",
"dirs-next", "dirs-next",
"eyre", "eyre",
"fdlimit",
"futures", "futures",
"metrics", "metrics",
"metrics-exporter-prometheus", "metrics-exporter-prometheus",

View File

@ -28,6 +28,7 @@ tracing-futures = "0.2"
tracing-subscriber = { version = "0.3", features = ["env-filter"] } tracing-subscriber = { version = "0.3", features = ["env-filter"] }
# io # io
fdlimit = "0.2.1"
walkdir = "2.3" walkdir = "2.3"
serde = "1.0" serde = "1.0"
serde_json = "1.0" serde_json = "1.0"

View File

@ -8,6 +8,7 @@ use crate::{
util::chainspec::{chain_spec_value_parser, ChainSpecification, Genesis}, util::chainspec::{chain_spec_value_parser, ChainSpecification, Genesis},
}; };
use clap::{crate_version, Parser}; use clap::{crate_version, Parser};
use fdlimit::raise_fd_limit;
use reth_consensus::BeaconConsensus; use reth_consensus::BeaconConsensus;
use reth_db::{ use reth_db::{
cursor::DbCursorRO, cursor::DbCursorRO,
@ -85,6 +86,10 @@ impl Command {
/// Execute `node` command /// Execute `node` command
// TODO: RPC // TODO: RPC
pub async fn execute(&self) -> eyre::Result<()> { pub async fn execute(&self) -> eyre::Result<()> {
// Raise the fd limit of the process.
// Does not do anything on windows.
raise_fd_limit();
let config: Config = confy::load_path(&self.config).unwrap_or_default(); let config: Config = confy::load_path(&self.config).unwrap_or_default();
info!("reth {} starting", crate_version!()); info!("reth {} starting", crate_version!());