Commit 171f3d896908aac2e85007ea69166a75e90f2c40
1 parent
b2a0ffde
Set systemd LimitNOFILE to infinite
Showing
2 changed files
with
3 additions
and
2 deletions
debian/flashmq.service
| @@ -6,7 +6,7 @@ After=network.target | @@ -6,7 +6,7 @@ After=network.target | ||
| 6 | Type=simple | 6 | Type=simple |
| 7 | User=root | 7 | User=root |
| 8 | Group=root | 8 | Group=root |
| 9 | -LimitNOFILE=1000000 | 9 | +LimitNOFILE=infinity |
| 10 | ExecStart=/usr/bin/FlashMQ --config-file /etc/flashmq/flashmq.conf | 10 | ExecStart=/usr/bin/FlashMQ --config-file /etc/flashmq/flashmq.conf |
| 11 | ExecReload=/bin/kill -HUP $MAINPID | 11 | ExecReload=/bin/kill -HUP $MAINPID |
| 12 | Restart=on-failure | 12 | Restart=on-failure |
mainapp.cpp
| @@ -707,7 +707,8 @@ void MainApp::setlimits() | @@ -707,7 +707,8 @@ void MainApp::setlimits() | ||
| 707 | struct rlimit v = { nofile, nofile }; | 707 | struct rlimit v = { nofile, nofile }; |
| 708 | if (setrlimit(RLIMIT_NOFILE, &v) < 0) | 708 | if (setrlimit(RLIMIT_NOFILE, &v) < 0) |
| 709 | { | 709 | { |
| 710 | - logger->logf(LOG_ERR, "Setting ulimit nofile failed: '%s'. This means the default is used.", strerror(errno)); | 710 | + logger->logf(LOG_ERR, "Setting ulimit nofile failed: '%s'. This means the default is used. Note. It's also subject to systemd's 'LimitNOFILE', " |
| 711 | + "which in turn is maxed to '/proc/sys/fs/nr_open', which can be set like 'sysctl fs.nr_open=15000000'", strerror(errno)); | ||
| 711 | } | 712 | } |
| 712 | } | 713 | } |
| 713 | 714 |