Too many open files

From VuzeWiki
Jump to: navigation, search
Symptom
After using Vuze for a while, you get messages popping up, saying that you couldn't open (some random file) because there are too many open files.
Problem
There really are too many open files.
  • Most operating systems set limits, how many files you can have open simultaneously. There may be both a global limit and a process-specific limit. A torrent may well include thousands of files, and if Vuze tries to open them all, the OS will complain.
  • In Vuze, the two main reasons for this error are a) the downloads you are running have many files in them, and b) you are connected to many many other clients (i.e. network socket connections).
  • Under unix, lots more things are files then might appear that way at first. The connection to your X server is a file, at least in as much as this error cares. Connections to trackers and peers (including seeds) are files, the files you're downloading are files (OK, no big surprise on that one), etc, etc.
Cures
  • Have less torrents active at the same time. Make sure that you follow the Good settings.
  • You can tell Vuze to only keep a limited number of file handles open by setting the Options > Files > Performance Options: Maximum files opened for read/write to something like 100 or so. Vuze will open/close files as needed. There is no need to have all files in all torrents open at the same time.
  • To limit the number of internet socket handles consumed by Vuze, set the Options > Transfer: Max. connections globally options to something less than 300. Please follow Good settings.
  • The previous actions should reduce the chances of seeing this error message. However, if you still reach the handle limit regularly, you can set the kernel limits higher in most Unix/Linux versions:
  • Normaly, processes, at least on linux, are limited to 1024 file handles each (most unixes will have a similar limit). This, however, is changable, which gives us our workaround. It's only changable by root, which creates some caveats on our workaround. The first caveat is that you must have root access. The second is that I'm only going to give a recepie for using sudo, not su, because I use sudo, and not su. (Note that this does not cause Vuze to run as root.)
  • The workaround: sudo bash -c 'ulimit -n 8192; sudo -u username ./azureus'
(This assumes you want Az to run via the user 'username'. It also assumes that you are in the right directory. Edit it to match local reality.)
  • To change the limit globally, you can edit /etc/security/limits.conf file.
  • Note that Vuze will still complain if it gets to 8192 open handles, rather than only 1024, but 8192 should be more than enough for even the craziest of downloaders...


Read the Azureus FAQ