Disclaimer. First I am NOT a SU. I'm a mid level computer user with a bit of experience. I can write some basic code, have used computers for 20+ years. MSDOS, to Windows through the years now I'm on OS X. I've searched high and low for a few weeks now and so have decided to come to the big guns to ask for assistance. I hope you're OK with this.
Firstly I'm on OS X 10.11.6
.
I have been having an issue with my Crashplan backup software and was working through it with their support people. It all came down to the error:
java.io.FileNotFoundException (Too many open files in system)
I read about and found I had to increase the number of open files allowed on my system. I did this creating and changing the values of files located in /Library/LaunchDaemons
.
I created two files:
limit.maxfiles.plist
and limit.maxproc.plist
Within limit.maxfiles.plist
I placed:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxfiles</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxfiles</string>
<string>54000</string>
<string>54000</string>
</array>
<key>RunAtLoad</key>
<true/>
<key>ServiceIPC</key>
<false/>
</dict>
</plist>
and within limit.maxproc.plist
I placed:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple/DTD PLIST 1.0//EN" "http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
<key>Label</key>
<string>limit.maxproc</string>
<key>ProgramArguments</key>
<array>
<string>launchctl</string>
<string>limit</string>
<string>maxproc</string>
<string>4096</string>
<string>4096</string>
</array>
<key>RunAtLoad</key>
<true />
<key>ServiceIPC</key>
<false />
</dict>
</plist>
I restarted and checked this had taken affect by running launchctl limit maxfiles
at the terminal. This showed that it was in effect.
I started crashplan again and it gave the same error. I checked with the crashplan people and they basically said tough, that's the problem, go fix it (which is fair enough I think).
So, I kept upping the number of files allowed to be open until I got to 900000000). Yes, that's a total of 900 million files allowed open. More than I have on my total drive. The error still persists. Checking with launchctl limit maxfiles
it shows that it is in effect.
So, that's left me stumped. I then looked around and found that I can run a command like so ulimit -S -n 900000
which will give some other part of the system more files to play with. I'm not sure how that works, but I checked it ulimit -a
and it was in effect. Same problem with Crashplan though.
So now I'm not sure what to do so I've come to ask the people who know OS's better than most. Can anyone offer some guidance as to what I can try to resolve this?
Thanks so much.
while true; do ts=$(date +%H_%M); sudo lsof > open_files_${ts}; wc -l open_files_${ts}; sleep 60; done
will capture process that have files open and count how many there once a minute. If the number is growing you can see the differences by diffing the results, e.g.:diff open_files_13_13 open_files_13_14
Don't be fooled since there are bound to be some differences; but if one process stands out consistently you may have a culprit. This will make a new, large file every minute until you interrupt it: Control-C