Skip to content

Commit

Permalink
Add hard fileno (#366)
Browse files Browse the repository at this point in the history
* increase the fileno limit

This allows wstunnel to use fds>1024.
Otherwise heavy use can easily run out of file descriptors on connection
attempts.
While there will still be a limit, it is significantly higher (~500
times on my system) which provides enough headroom for connections to be
torn down and fds to be closed.
  • Loading branch information
Ongy authored Nov 8, 2024
1 parent 820cb22 commit 0504395
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 1 deletion.
11 changes: 11 additions & 0 deletions Cargo.lock

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

2 changes: 2 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ ppp = { version = "2.2.0", features = [] }
async-channel = { version = "2.3.1", features = [] }
arc-swap = { version = "1.7.1", features = [] }

fdlimit = "0.3.0"

# For config file parsing
regex = { version = "1.11.0", default-features = false, features = ["std", "perf"] }
serde_regex = "1.1.0"
Expand Down
5 changes: 4 additions & 1 deletion src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ use base64::Engine;
use clap::Parser;
use hyper::header::HOST;
use hyper::http::{HeaderName, HeaderValue};
use log::debug;
use log::{debug, warn};
use parking_lot::{Mutex, RwLock};
use std::collections::BTreeMap;
use std::fmt::Debug;
Expand Down Expand Up @@ -727,6 +727,9 @@ async fn main() -> anyhow::Result<()> {
} else {
logger.init();
};
if let Err(err) = fdlimit::raise_fd_limit() {
warn!("Failed to set soft filelimit to hard file limit: {}", err)
}

match args.commands {
Commands::Client(args) => {
Expand Down

0 comments on commit 0504395

Please sign in to comment.