LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-09-2017, 10:54 AM   #1
greyarea
LQ Newbie
 
Registered: Jan 2008
Distribution: Centos5/RHEL5
Posts: 27

Rep: Reputation: 0
ulimit question CentOS 6/7


I have a question regarding ulimits. I have a CentOS 6 system and if I issue ‘ulimit –Hn’ I see that the maximum number of open file descriptors is set to 4096.

I tried to see if I could hit this limit so I wrote a small C program that loops through a bunch of files and fopen()’s 5000 of them, the code then waits for user input which it never gets therefore leaving the files open. I managed to run this code and the result of ‘lsof –u myuser | wc –l’ gave me a figure of around 5035.

Shouldn’t I have been prevented from opening this many files by ulimit?

Also, on a CentOS 6/7 system, where does a message get logged to if a process exceeds a ulimit – is it /var/log/secure?

Thanks
 
Old 08-09-2017, 01:00 PM   #2
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Starting with RHEL6 (and therefore derived distros such as CentOS6) in addition to /etc/security/limits.conf they began using files in /etc/security/limits.d. The latter is a directory and anything setup in that directory overrides what is in limits.conf file.

Specifically they added 90-nproc.conf to limits.d subdirectory so the values it contains are the active ones even though they didn't note this in limits.conf itself as they should have. It caused much gnashing of teeth and still bites people that haven't run across it yet.
 
Old 08-10-2017, 06:11 AM   #3
greyarea
LQ Newbie
 
Registered: Jan 2008
Distribution: Centos5/RHEL5
Posts: 27

Original Poster
Rep: Reputation: 0
Thanks MensaWater, do you have any idea why the limits don't seem to enforce or about the logging location?

Any method of testing ulimit would be useful, I'm trying to reproduce a reported problem.
 
Old 08-10-2017, 01:40 PM   #4
MensaWater
LQ Guru
 
Registered: May 2005
Location: Atlanta Georgia USA
Distribution: Redhat (RHEL), CentOS, Fedora, CoreOS, Debian, FreeBSD, HP-UX, Solaris, SCO
Posts: 7,831
Blog Entries: 15

Rep: Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669Reputation: 1669
Type "man ulimit" then go to the ulimit section of the bash man page it displays.

There it tells you:
-n The maximum number of open file descriptors (most systems
do not allow this value to be set)

Presumably your system doesn't really allow the value to be set.
 
  


Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
ulimit -s 40960 vs ulimit ulimit -s 10240 centguy Linux - Software 2 10-22-2016 11:38 PM
[SOLVED] Cannot set ulimit -l, says ulimit: max locked memory: cannot modify limit Xiano Slackware 1 07-24-2014 02:58 AM
Centos 6.4 ulimit and HAProxy issue dnyaneshwar.sonawane Linux - Server 4 05-29-2014 01:55 PM
[SOLVED] How can i set ulimit value in centos jsaravana87 Linux - Server 4 04-30-2012 08:58 AM
Ulimit Question dman777 Linux - Security 1 01-26-2011 09:56 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 01:58 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration