3

The logfile of my Tor relay is filled with thousands of lines saying:

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

By googling I found out, that this might have to do with the fact, that Tor is running on a virtual server. But when it comes to tell what the solution is, I only find links to a site that is no longer available.

Do you know how to solve this problem?

EDIT:

9 hours before the end of this bounty I still did get no answer that tells me what to do to solve the problem.

summary of my comments:
I am running Linux (Ubuntu 14.04 LTS) on a remote virtual server, hosted in a commercial serverfarm.

On my virtual server the limit of numtcpsock is 1360. But I still don't know what to do. In torrc I've set ConstrainedSockets 1 and ConstrainedSockSize 2048 bytes, but it didn't help.

  • What operating system are you running? – Sam Whited Dec 1 '14 at 19:34
  • I am running Linux (Ubuntu 14.04 LTS) on a remote virtual server, hosted in a commercial serverfarm. – Hubert Schölnast Dec 4 '14 at 12:24
2
+25

I only find links to a site that is no longer available

Are you running on a "virtual server" by any chance? http://wiki.noreply.org/noreply/TheOnionRouter/TorFAQ#VServer

leads to 404

but google TorFAQ#VServer gives https://www.torproject.org/docs/faq#VirtualServer

then another google gives in Tor installation guides :

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.

The preferred solution is to have the admin increase the buffer pool for the host itself via /proc/sys/net/ipv4/tcp_mem or equivalent facility; this configuration option is a second-resort.

The DirPort option should also not be used if TCP buffers are scarce. The cached directory requests consume additional sockets which exacerbates the problem.

You should not enable this feature unless you encounter the "no buffer space available" issue. Reducing the TCP buffers affects window size for the TCP stream and will reduce throughput in proportion to round trip time on long paths. (Default: 0) ConstrainedSockSize N bytes|KBytes

When ConstrainedSockets is enabled the receive and transmit buffers for all sockets will be set to this limit. Must be a value between 2048 and 262144, in 1024 byte increments. Default of 8192 is recommended.

BUT on my vserver from OneAndOne (1&1, germany), cheap offer is very very very limited.

first, IPTABLES rules number and -j target are extremely limited (not LOG for example). but also the network conf is limited

Do a #watch cat /proc/user_beancounters and watch for numtcpsock

When it hits the limit, error messages appears (use arm to monitor tor) and any webserver mail server will go mad.

One&One puts a limit of 360 tcpsock. Hit in 5 minutes !!!

  • On my virtual server the limit of numtcpsock is 1360. But I still don't know what to do. In torrc I've set ConstrainedSockets 1 and ConstrainedSockSize 2048 bytes, but it didn't help. – Hubert Schölnast Dec 2 '14 at 20:06
  • you do not tell anything usefull about numtcpsock !! the limit is 1360, ok, but the actual usage is what ? what is your commercial serverfarm ? – user5289 Dec 13 '14 at 21:10
1

You're most likely hitting the cap for the number of open file descriptors on your operating system.

Linux

To see the number of descriptors currently in use (on a machine with the /proc filesystem), you can look at the /proc/sys/fs/file-max virtual device:

$ cat /proc/sys/fs/file-max 
792823

or run:

sysctl fs.file-max

and to check the actual limit (-H is the hard limit, -S is the soft limit) run:

$ ulimit -Hn
4096
$ ulimit -Sn
1024

as the user for which you want to check the limit. To change this on Linux, edit the /etc/sysctl.conf file:

fs.file-max = 100000

You'll need to log out and back in, or run sysctl -p for the changes to take effect.

To change the FD limit for a specific user, look in the /etc/security/limits.conf file and add lines like the following:

username soft nofile 4096
username hard nofile 10240

BSD

On BSD based systems, the sysctl variable is called kern.maxfiles:

sysctl kern.maxfiles

OS X

To check the limit on OS X run:

launchctl limit maxfiles

and look at the last two columns (soft and hard limits respectively). To change the limits create a property list at: /Library/LaunchDaemons/limit.maxfiles.plist and add the following:

<?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>65536</string>
        <string>65536</string>
      </array>
    <key>RunAtLoad</key>
      <true/>
    <key>ServiceIPC</key>
      <false/>
  </dict>
</plist>

Modifying the properties as necessary. Then create /Library/LaunchDaemons/limit.maxproc.plist with the following:

<?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>2048</string>
        <string>2048</string>
      </array>
    <key>RunAtLoad</key>
      <true />
    <key>ServiceIPC</key>
      <false />
  </dict>
</plist>

then chown both files to root:wheel and chmod them to 644 (-rw-r--r--). Now restart or run launchctl limit to apply.

For older versions of OS X, this tutorial may help.

Solaris

In solaris, add a line like the following:

set rlim_fd_max=65536

to /etc/system (see this blog post for more info)

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.