mirror of
https://github.com/mailscope/kumomta.git
synced 2026-10-26 08:16:13 +00:00
kumod: raise soft rlimit nofile -> hard limit on startup
This commit is contained in:
@@ -37,7 +37,7 @@ minijinja = {version="0.30",features=["source"]}
|
||||
mlua = {version="0.8", features=["vendored", "lua54", "async", "send", "serialize"]}
|
||||
mod-redis = {path="../mod-redis"}
|
||||
mod-sqlite = {path="../mod-sqlite"}
|
||||
nix = "0.26"
|
||||
nix = {version="0.26", features=["resource"]}
|
||||
once_cell = "1.17"
|
||||
ouroboros = "0.15"
|
||||
prometheus = "0.13"
|
||||
|
||||
@@ -4,6 +4,7 @@ use anyhow::Context;
|
||||
use caps::{CapSet, Capability, CapsHashSet};
|
||||
use clap::{Parser, ValueEnum};
|
||||
use metrics_prometheus::recorder::Layer;
|
||||
use nix::sys::resource::{getrlimit, setrlimit, Resource};
|
||||
use nix::unistd::{Uid, User};
|
||||
use std::path::PathBuf;
|
||||
use tracing_subscriber::fmt::writer::BoxMakeWriter;
|
||||
@@ -116,6 +117,9 @@ fn main() -> anyhow::Result<()> {
|
||||
// runtime after we've called it.
|
||||
opts.drop_privs()?;
|
||||
|
||||
let (_no_file_soft, no_file_hard) = getrlimit(Resource::RLIMIT_NOFILE)?;
|
||||
setrlimit(Resource::RLIMIT_NOFILE, no_file_hard, no_file_hard)?;
|
||||
|
||||
tokio::runtime::Builder::new_multi_thread()
|
||||
.enable_all()
|
||||
.build()
|
||||
|
||||
Reference in New Issue
Block a user