Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A caution on modifying kern.maxfiles values UNIX
I had a devastating experience this morning. On an unrelated issue, I have been hitting up against a max files limit on one of my servers. I noticed that setting ulimit -n unlimited only set it to 12288. I also noticed that in sysctl, the kern.maxfiles value was set to 12288. So, I decided to be smart and try:
sysctl -w kern.maxfiles=unlimited
I got this as response:
kern.maxfiles 12288 -> 0
So, thinking zero means unlimited (because that is the way it is with some applications!), I ran:
ulimit -n unlimited
Unfortunately, this promptly set my open files limit to zero! Immediately, apps stopped running. I continued to have a session, but I couldn't do anything at all. I couldn't set sysctl back; I couldn't reboot; I couldn't do anything. And since the server is 3,000 miles away from me in Phoenix, I had to call and pay for it to be rebooted by hitting the reset button. (Yes, I know, we need a remote reboot switch.)

So, whatever you do, don't set kern.maxfiles=unlimited!
    •    
  • Currently 2.75 / 5
  • 1
  • 2
  • 3
  • 4
  • 5
  (4 votes cast)
 
[9,338 views]  

A caution on modifying kern.maxfiles values | 1 comments | Create New Account
Click here to return to the 'A caution on modifying kern.maxfiles values' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
sysctl doesn't understand "unlimited"
Authored by: hayne on Sep 07, '05 11:34:46AM

I looked at the source code for the 'sysctl' utility and it seems that it does not do anything special with the string "unlimited" - i.e. it does not understand that as a valid value at all.
In fact, if you supply any string that doesn't start with an integer when you are using the "-w" to set an integer parameter value, it will result in the parameter getting set to zero. This is a consequence of bad error handling in the 'sysctl' utility. If you give it a string like "xyz" or anything other than an integer, it will effectively take it as zero.
I have reported this bug to Apple.



[ Reply to This | # ]