I’ve been having trouble with my server running out of file handles recently (ouch). Cyrus and Apache and rtorrent all do their fair share of abuse of my server, lsof typically reports 20k open files and sockets. rtorrent kept crapping out with “can’t resolve host” and “can’t save torrent file” errors, related to running out of file handles. Very hard to determine why this was happening. Eventually google turned up the answer on gentoo forums – re-emerge curl with these USE flags in [/etc/portage/package.use]:

net-misc/curl ares -threads

All is full of light.