You are not logged in.

#1 2017-03-15 20:26:06

alex.forencich
Member
Registered: 2011-05-29
Posts: 90

ulimit settings ignored

I am running into an issue with transmission-daemon.  It refuses to start with multiple errors related to "too many open files"

[2017-03-15 13:19:07.246] Couldn't create socket: Too many open files (fdlimit.c:524)
[2017-03-15 13:19:07.246] Couldn't create socket: Too many open files (fdlimit.c:524)
[2017-03-15 13:19:07.246] Couldn't create socket: Too many open files (fdlimit.c:524)
[2017-03-15 13:19:07.246] Couldn't create socket: Too many open files (fdlimit.c:524)
[2017-03-15 13:19:07.246] Couldn't create socket: Too many open files (fdlimit.c:524)
[2017-03-15 13:19:07.246] Couldn't create socket: Too many open files (fdlimit.c:524)
[2017-03-15 13:19:07.246] Couldn't create socket: Too many open files (fdlimit.c:524)

This appears to be related to ulimit -n being set to 1024.  So I adjusted this in /etc/security/limits.conf as ulimit -Hn and ulimit -Sn report the new values:

$ ulimit -Hn
16384
$ ulimit -Sn
16384

However, transmission still fails with the same error, even when run in the foreground (not daemonized) directly from the command line (not via systemd).  Yes, I did reboot.  On further inspection in /proc, it looks like the setting is getting ignored somewhere as the hard limit is correct, but the soft limit is still 1024:

cat /proc/5210/limits
Limit                     Soft Limit           Hard Limit           Units
Max cpu time              unlimited            unlimited            seconds
Max file size             unlimited            unlimited            bytes
Max data size             unlimited            unlimited            bytes
Max stack size            8388608              unlimited            bytes
Max core file size        unlimited            unlimited            bytes
Max resident set          unlimited            unlimited            bytes
Max processes             128560               128560               processes
Max open files            1024                 16384                files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       128560               128560               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us

I have seen suggestions to modify daemon startup scripts to add a ulimit command, but those are irrelevant here as this is a problem even when running transmission-daemon -f directly from the terminal, bypassing any such startup scripts. 

Any ideas on what might be going on here?

Last edited by alex.forencich (2017-03-15 20:27:18)

Offline

#2 2019-03-14 12:21:20

yaoge123
Member
Registered: 2019-03-14
Posts: 1

Re: ulimit settings ignored

/usr/bin/prlimit --nofile=131072: --pid <transmission-daemon>

Offline

#3 2019-03-14 17:15:18

V1del
Forum Moderator
Registered: 2012-10-16
Posts: 6,615

Re: ulimit settings ignored

Thanks for sharing, however please don't bump 2 year old threads (also with the recent file limit restriction adjustments in systemd, I doubt that one would still run into the same issue now)

Closing.

Offline

Board footer

Powered by FluxBB