From 171f3d896908aac2e85007ea69166a75e90f2c40 Mon Sep 17 00:00:00 2001 From: Wiebe Cazemier Date: Sat, 30 Jul 2022 16:16:20 +0200 Subject: [PATCH] Set systemd LimitNOFILE to infinite --- debian/flashmq.service | 2 +- mainapp.cpp | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/debian/flashmq.service b/debian/flashmq.service index b31b551..b7be944 100644 --- a/debian/flashmq.service +++ b/debian/flashmq.service @@ -6,7 +6,7 @@ After=network.target Type=simple User=root Group=root -LimitNOFILE=1000000 +LimitNOFILE=infinity ExecStart=/usr/bin/FlashMQ --config-file /etc/flashmq/flashmq.conf ExecReload=/bin/kill -HUP $MAINPID Restart=on-failure diff --git a/mainapp.cpp b/mainapp.cpp index d80d5d3..15e3eaa 100644 --- a/mainapp.cpp +++ b/mainapp.cpp @@ -707,7 +707,8 @@ void MainApp::setlimits() struct rlimit v = { nofile, nofile }; if (setrlimit(RLIMIT_NOFILE, &v) < 0) { - logger->logf(LOG_ERR, "Setting ulimit nofile failed: '%s'. This means the default is used.", strerror(errno)); + logger->logf(LOG_ERR, "Setting ulimit nofile failed: '%s'. This means the default is used. Note. It's also subject to systemd's 'LimitNOFILE', " + "which in turn is maxed to '/proc/sys/fs/nr_open', which can be set like 'sysctl fs.nr_open=15000000'", strerror(errno)); } } -- libgit2 0.21.4