I've recently upgraded to OSX Mavericks and since then, I've started getting the aforementioned error on my development machine. There is no obvious problem in the code (it's an auto generated Yii sample application). What has happened as part of upgrade to Mavericks is:
Ever since, I'm getting this problem after maybe loading and reloading the website a few time. After this error occurs, my web server keeps returning the same error for any other application hosted on localhost. I have to mention that static web pages are served up fine.
I've seen several threads on this topic. Most point out to issues in code where file handles are not being closed properly, thereby crossing the open file limit threshold. I also found this thread which seems to suggest this might be a zend debugger issue. There's also a bug report filed for php 5.2.x. Following the thread here, I tried the following:
$ ulimit -a
which reports:
open files (-n) 256
Also,
sysctl -a | grep files
returns,
kern.maxfiles = 12288 kern.maxfilesperproc = 10240 kern.maxfiles: 12288 kern.maxfilesperproc: 10240 kern.num_files: 3248
Another interesting thread suggests to raise this limit (currently 256) using:
ulimit -n 1024
I've tried everything, but nothing seems to be working. The problem is also not consistently reproducible.
I am wondering is using ulimit -n 1024
is going to affect apache, since from what I've read, it affects the number of files shell can have open.
Any help is appreciated.
EDIT:
apache
helps for a bit, till the error is encountered again.A simple fix for the "too many files open" limitation of Mac OS is to use the "ulimit - n" command. Curiously, the value of n appears to be critical to whether or not this command is accepted by MacOS. I've found that ulimit -n 10240 (the default is 256) works but n values higher do not.
4. Look at the Bottom of Your Finder Window. Now at the bottom of your finder window, you should see a gray bar that tells you how many files are in that folder on your Mac. This will show on every Finder window that you open.
Shamelessly stolen from http://docs.basho.com/riak/latest/ops/tuning/open-files-limit/#Mac-OS-X
To check the current limits on your Mac OS X system, run:
$ launchctl limit maxfiles
The last two columns are the soft and hard limits, respectively.
To adjust the maximum open file limits in OS X 10.7 (Lion) or newer, edit /etc/launchd.conf and increase the limits for both values as appropriate.
For example, to set the soft limit to 16384 files, and the hard limit to 32768 files, perform the following steps:
Verify current limits:
$ launchctl limit cpu unlimited unlimited filesize unlimited unlimited data unlimited unlimited stack 8388608 67104768 core 0 unlimited rss unlimited unlimited memlock unlimited unlimited maxproc 709 1064 maxfiles 10240 10240
Edit (or create) /etc/launchd.conf and increase the limits. Add lines that look like the following (using values appropriate to your environment):
limit maxfiles 16384 32768
Save the file, and restart the system for the new limits to take effect. After restarting, verify the new limits with the launchctl limit command:
$ launchctl limit cpu unlimited unlimited filesize unlimited unlimited data unlimited unlimited stack 8388608 67104768 core 0 unlimited rss unlimited unlimited memlock unlimited unlimited maxproc 709 1064 maxfiles 16384 32768
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With