1

I have a process which is running as golden user and I am trying to increase the open file limit for that user so that all the process that gets started up by that user, it should uses that settings. I changed the limits into below file and changes are not taking into affect:

/etc/security/limits.conf:

*       soft    nofile  65535
*       hard    nofile  100000

I modified settings for all the users by changing the limits for * wildcard as shown above. Now I started my process as golden user and I executed below cat command and I see it is using 8092 as open files so I am not sure why my changes are not getting into affect.

golden@machineA:~$ cat /proc/1442/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             483036               483036               processes
Max open files            8092                 8092                 files
Max locked memory         65536                65536                bytes
Max address space         unlimited            unlimited            bytes
Max file locks            unlimited            unlimited            locks
Max pending signals       483036               483036               signals
Max msgqueue size         819200               819200               bytes
Max nice priority         0                    0
Max realtime priority     0                    0
Max realtime timeout      unlimited            unlimited            us

I am using Ubuntu 14.04 box. Any idea what is wrong here and how can I make sure all process that gets started with golden user uses the new open file configuration? I think there is some place where 8092 is hardcoded because of which it is not overriding this value.

cat /proc/sys/fs/file-max
6145946
  • What if you use the ulimit built-in? – B Layer Sep 9 '17 at 3:32
  • ulimit -a on that user shows right value but for that process it shows 8092 value always. – david Sep 9 '17 at 3:35
  • I mean use ulimit to set the value rather than editing files. – B Layer Sep 9 '17 at 3:37
  • if I use ulimit to se the value then it won't be persistent right? – david Sep 9 '17 at 3:46
  • Yes, but for a single user scenario like this it's common to set limits in the user's .bash_profile or .bashrc file by calling ulimit there. (though you can't set soft limits higher than hard limits...those will need to be set by root) – B Layer Sep 9 '17 at 3:48
2

/etc/limits is a login-time setting. A change there applies when a user logs in, not when a process is started. There is no configuration for process startup. A process inherits the limits of its parent.

Note that a process can always choose to lower its limits. If you start a login session, and confirm the higher limits by running ulimit -a in a shell, and run the process in that shell, and the process's limits end up lower, it means that the process is lowering its limits. If so you'll have to explore the program's configuration to see if you can prevent it from doing that.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.