Fixed: maxchild dropped to 100 on config reload if not explicitly set, system-specific tuning hints added to doc

This commit is contained in:
Vladimir Dubrovin committed 2026-08-01 10:22:03 +03:00
1 parent 7b85f6a684
commit 763e21e053
8 files changed
+299 -25

No files matched your search

+10 -3
View File
@@ -1,6 +1,6 @@
[Unit]
Description=3proxy tiny proxy server
Documentation=man:3proxy(1)
Documentation=man:3proxy(8) man:3proxy.cfg(5)
After=network.target
[Service]
@@ -13,8 +13,15 @@ ExecReload=/bin/kill -SIGUSR1 $MAINPID
KillMode=process
Restart=on-failure
RestartSec=60s
LimitNOFILE=65536
LimitNPROC=32768
# 3proxy uses one thread and two descriptors per connection (four for ftppr),
# so it reaches these limits much earlier than event driven servers. They are
# ceilings only: the actual number of connections is governed by 'maxconn' in
# the configuration file. TasksMax must be set explicitly, systemd's
# DefaultTasksMax (15% of kernel.threads-max, e.g. ~9000) otherwise caps the
# number of threads, and thus connections, regardless of LimitNPROC.
LimitNOFILE=1048576
LimitNPROC=infinity
TasksMax=infinity
RuntimeDirectory=3proxy
RuntimeDirectoryMode=0755
+10
View File
@@ -24,9 +24,19 @@ if [ -f /etc/init.d/functions ]; then
. /etc/init.d/functions
fi
# SysV init does not apply limits.conf consistently: start-stop-daemon does not
# open a PAM session, so pam_limits is not involved and the daemon inherits the
# limits of init. 3proxy needs two descriptors per connection (four for ftppr),
# so raise them here. Adjust to match 'maxconn' in the configuration file.
set_limits() {
ulimit -n 65536 2>/dev/null || ulimit -n 4096 2>/dev/null || true
ulimit -u 32768 2>/dev/null || true
}
case "$1" in
start)
echo -n "Starting 3Proxy: "
set_limits
if [ ! -d /var/run/3proxy ]; then
mkdir -p /var/run/3proxy