I've got a relay on an OpenVZ VPS which is constrained by the number of sockets available for use. (numtcpsock in /proc/user_beancounters).

This results in my getting these errors in my Tor log:

[warn] Error creating network socket: No buffer space available

Obviously I can keep under the maximum number of sockets by reducing my advertised bandwidth, but that defeats the purpose of running a relay. I've got much more bandwidth available to my server but can't take advantage of it due to the socket limit.

The vendor of my VPS won't raise the limit on TCP sockets.

So... is there a way in Tor to reduce the number of sockets used for a given bandwidth configuration?

1 Answer 1


It looks like you're hitting the limit on kernel memory used for the send/receive buffers, not the absolute number of sockets.

   ConstrainedSockets 0|1
       If set, Tor will tell the kernel to attempt to shrink the buffers
       for all sockets to the size specified in ConstrainedSockSize. This
       is useful for virtual servers and other environments where system
       level TCP buffers may be limited. If you’re on a virtual server,
       and you encounter the "Error creating network socket: No buffer
       space available" message, you are likely experiencing this problem.

This will reduce performance, as TCP performs the best when the receive window is equal to the bandwidth delay product of the link (and default behavior is to do so when possible).

If you are additionally hitting a limit on the number of sockets, you probably should reduce the Advertized Bandwidth, because circuit failures (what happens when a relay fails to create a socket when requested) is harmful to user anonymity (the relay is forcing the client to re-do the path selection algorithm).

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .