0

I am running a non-exit Tor relay for the last few weeks and it is working but it is not maxing the Internet pipe. (The server is >2 weeks old, so not a problem of age)

The problem is that it seems that Tor's file descriptor usage are at 100%. Nyx shows this:

file descriptors: 4074 / 4064 (100%)

I am running the server on an unprivileged LXC container and it just works fine but this is what is bugging me out. Is that number of file descriptors acceptable, or should I raise it? How does it get filled? Doesn't it get (recycled?) at certain times?

I have enough RAM and CPU as they are idling at 15% usage. By the way, I am running a directory. Don't know if that affects to file descriptors usage.

I haven't been able to find any answer to this matter. Hope you can help me.

  • do you have a static or dynamic IP from your ISP? - i'm not sure if it applies to your case, but i read somewhere, that dynamic IPs are not that good for relays... if this is the case, providing a bridge is a better way of contributing. -- BUT again: it's just a shot in the dark! – DJCrashdummy Mar 22 at 6:50
0

The Tor manual states:

Tor will ask the OS for as many file descriptors as the OS will allow (you can find this by "ulimit -H -n"). If this number is less than ConnLimit, then Tor will refuse to start.

This number appears to be the denominator of the fraction you see in Nyx (4064). It's returned from tor to Stem by the process/descriptor-limit control message.

The number of in-use file descriptors (4074) comes directly from Stem, which simply counts the number of items in /proc/$pid/fd.

return len(os.listdir('/proc/%i/fd' % pid))

The Tor source code also has a tuning document that describes how to increase the number of available file descriptors if you are running low.

Most operating systems limit an amount of TCP sockets that can be used simultaneously. It is possible for a busy Tor relay to run into these limits, thus being unable to fully utilize the bandwidth resources it has at its disposal. Following system-specific tips might be helpful to alleviate the aforementioned problem.

Linux

Use 'ulimit -n' to raise an allowed number of file descriptors to be opened on your host at the same time.

The Nyx source code shows that it logs a warning message if the file descriptor usage is above 90%. You should check for this message.

log_msg = "Tor's file descriptor usage is at %s%%. If you run out Tor will be unable to continue functioning." % fd_percent
log.log_once('fd_used_at_ninety_percent', log.WARN, log_msg)

It would probably be a good idea to raise the limit in the kernel and see what happens. I wouldn't be sure that you'll get much more traffic, as some Tor relays aren't getting the max bandwidth that they specify in their torrc.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.