Tor Process Being Killed on VPS

Hello, I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck? Thanks, Steve

On Thu, 25 Feb 2016 18:19:44 -0500 Stephen R Guglielmo <srguglielmo@gmail.com> wrote:
Hello,
I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck?
If you VPS is based on KVM, Xen or VMware (i.e. not the container-based OpenVZ), you could add some swap space. But if it gets used too hard, you risk getting warned or terminated by your VPS provider for disk I/O abuse. And of course some performance degradation will occur as soon as Tor doesn't fit entirely into RAM and has to use the swap. -- With respect, Roman

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 This happend before with my 512MB node, when it was set unlimited amount of Mbit/sec. Also swap might help. On February 26, 2016 12:19:44 AM GMT+01:00, Stephen R Guglielmo <srguglielmo@gmail.com> wrote:
Hello,
I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck?
Thanks, Steve
------------------------------------------------------------------------
_______________________________________________ tor-relays mailing list tor-relays@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays
- -- PGP : 29A4CE52 -----BEGIN PGP SIGNATURE----- iQI4BAEBCgAiGxxEbyA8eWFuZGVyZXNvbkByaXNldXAubmV0PgUCVtAkBAAKCRBI of/XNyszSqaqEACRw7fPjWfMmHKuwXtOq8OnWcAqwRTXk/K+JEEx8JfwFCXqN++c ElpFrmAHnj+cGGnAsQSr9qjfCTq18pWXJwOAUOtTyBmsAJ0xthEjcaYyZQ0TRdUt QHSO8qskEo6ijOXqA6Q8f8q7jOI/TUZ1gBLtl+5gRqawAJW2czKKvwGHN53Ptal7 xvi7gO0sdSKkvS0wqzfSbuQcdz/NKgRNRyrTSzlOICokvdgPv/Q0NnPkPQUrDf1W 1jN9F5gKGrLHBAOwNGnJvCPc5sJCiVZenloq+OXLGuqXseLIwJA1eOcyJHhnjkfW vwQB3tHwH+cAvW+GD6lVTaPEdGC+MX1S14CjPl3/1isRGLIFkormBZbztHRpugv0 TNZnZudlMsxlxSWQEG2YaMJGvnDks2tcgSHaMgowzku6U/uUCZ4Q+xe/O1J8LE4e dBLLU2JI6IjY9qBuH1O+DwebnSXMiUzVxCq3yPmqEmeKjLRLYji9ZWwG4LHtcptt 3gvv0LUKvPzbijCnMbc394WGSIRxaU56z/+ZZIqWMmbPw0zaRlRuihdNs5g/pWT6 DIXIUZT18sdhenCqVUtpByO0/+uQNdCQc9uleVBWdS6ZQ0QNyFadESb3o4LSlk5g CQF4eexg2zDafv662D7F3gdHb6S0nZpvWAIVCTeDVxGHn/hg5m6G8rKw/g== =EKdH -----END PGP SIGNATURE-----

I'm unfamiliar with the memory use of nginx, but 512MB ought to be more than enough RAM to run just the relay on a 64-bit VPS.. Are you *sure* you're not running anything else? Not crond? Not ntpd? Not iptables? If not SSH, how do you administer the VPS? What type of virtualization is the VPS using? If not OpenVZ, make sure you have virtual memory on the system. You can create a swapfile if don't already have a swap partition. Do you have SELinux enabled in the VPS? if so, get rid of it. Finally, you may have to ditch nginx and just use Tor and the system utilities to monitor performance. On 02/25/2016 06:19 PM, Stephen R Guglielmo wrote:
Hello,
I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck?

On Fri, 26 Feb 2016 08:05:06 -0500 Steve Snyder <swsnyder@snydernet.net> wrote:
I'm unfamiliar with the memory use of nginx, but 512MB ought to be more than enough RAM to run just the relay on a 64-bit VPS..
Are you *sure* you're not running anything else? Not crond? Not ntpd? Not iptables? If not SSH, how do you administer the VPS?
IPTables is configured, but no firewall daemon is running. NTPd is not running (I've tried, but the kernel does not have permission to set the clock; I assume this is due to the hypervisor setup). SSH is not running. I have console access through the control panel. Cron and rsyslog are running. I didn't include them in my original post because assumed that others would assume they'd be running since they're quite common and regular system daemons. Here's a full output of `ps aux` that I just ran (it's not very long): https://gist.github.com/srguglielmo/63290d10b1bba434c77d
What type of virtualization is the VPS using? If not OpenVZ, make sure you have virtual memory on the system. You can create a swapfile if don't already have a swap partition.
It uses KVM. It doesn't currently have swap space, so I'll add a swapfile for the system to use. Hopefully this will solve the problem.
Do you have SELinux enabled in the VPS? if so, get rid of it.
I'll double check this and make sure to disable it if enabled. Thanks!
Finally, you may have to ditch nginx and just use Tor and the system utilities to monitor performance.
Some additional information. Here's the out-of-memory errors I've been seeing in /var/log/messages. https://gist.github.com/srguglielmo/e2693513e3502a0d5196 It seems that systemd restarts Tor whenever it's killed. `free -m`: total used free shared buff/cache available Mem: 489 303 16 8 169 124 Swap: 0 0 0 I'll look into enabling swap and ensuring SELinux is disabled. Hopefully that will help. Thank you!
On 02/25/2016 06:19 PM, Stephen R Guglielmo wrote:
Hello,
I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck?

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512 Stephen R Guglielmo:
NTPd is not running (I've tried, but the kernel does not have permission to set the clock; I assume this is due to the hypervisor setup). Hhm, ntp should be able to set the unix time for and within your virtual machine. It's more likely not allowed to write to hwclock during shutdown.
- -- Toralf PGP: C4EACDDE 0076E94E, OTR: 420E74C8 30246EE7 -----BEGIN PGP SIGNATURE----- iF4EAREKAAYFAlbQ2AUACgkQxOrN3gB26U62IAD/XsSgDYItLBzWUABBhd4DEvOl AIgOxM//4FyWAVwc034A/0p6LnQLhOFtIdOfz+9MgAqjSSPmKdbzySG3TMe8GN7F =jE33 -----END PGP SIGNATURE-----

On Fri, 26 Feb 2016 22:56:05 +0000 Toralf Förster <toralf.foerster@gmx.de> wrote:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA512
Stephen R Guglielmo:
NTPd is not running (I've tried, but the kernel does not have permission to set the clock; I assume this is due to the hypervisor setup). Hhm, ntp should be able to set the unix time for and within your virtual machine. It's more likely not allowed to write to hwclock during shutdown.
Ah, you're right. I was thinking of my other VPS with OpenVZ. It gives me a "permission denied" when the date is set (even as root). I'll get OpenNTPd going on there right away.

-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA256 Hello, More information is needed. Please indicate the type of virtualization used (VMware, Xen, KVM, OpenVZ), your operating system and Tor version as well as the "out of memory" log messages you mentioned - are these from kernel logs or Tor's log?. Setting Tor's log level to debug mode or info mode could also help. On 2/26/2016 1:19 AM, Stephen R Guglielmo wrote:
Hello,
I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck?
Thanks, Steve
-----BEGIN PGP SIGNATURE----- Version: GnuPG v2.0.22 (MingW32) iQEcBAEBCAAGBQJW0GtYAAoJEIN/pSyBJlsR0TIIAMnMD34Qn3LBOHMh3ITGMQtk FvIvQZZPv9iOuggZpn8DP1GoU4Zxr08Cuxct4GTrJfTanvB33RMs6DuMm6cZB7f9 haSpu7hvE1vMf/9vkhwkrBR8BfAWQ+Nzm5EgkyH8nZd2/oMN0ZUL5QM5Arnd7gMQ xDj+wJZmvIKHEgkjFfc+2JmnNuVKVKDUK27fj/O28lEg1AS4CtC9sOgEZeySzxmE AtDW4nfn1PE+ihoLF6oM5gvpuYG87XUJuuT/Yzh6R/KfzHyr2wJgvd7irB1w4163 v5QIMcpUxa/jvaUApSNAfnah0QI1IZHQU6/CInMJpXoMCegX/BGZVxzVEEWteug= =vipy -----END PGP SIGNATURE-----

clearing the memory cache with a cron job cant hurt On Thu, Feb 25, 2016 at 6:19 PM, Stephen R Guglielmo <srguglielmo@gmail.com> wrote:
Hello,
I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck?
Thanks, Steve
_______________________________________________ tor-relays mailing list tor-relays@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays

On Fri, Feb 26, 2016 at 04:03:14PM -0500, Steven Jones wrote:
clearing the memory cache with a cron job cant hurt
Yes it can. There is no reason to clear the vm cache manually unless you are testing cache-related code paths. The kernel will automatically reclaim cache memory for program memory should the need arise, and uses the otherwise idle/free memory for disk cache. Clearing cache will only degrade the performance of your machine while the cached material is re-read from disk. --Sean

echo 3 | tee /proc/sys/vm/drop_caches On Thu, Feb 25, 2016 at 6:19 PM, Stephen R Guglielmo <srguglielmo@gmail.com> wrote:
Hello,
I have a VPS with 512 MB RAM. I run nothing on it except nginx and a Tor relay. The relay is an entry guard and moves about 20 MB/s. It seems that the kernel is killing the Tor process with "out of memory" errors. Are there any tips for mitigating this? I don't have the money right now to upgrade to the next higher VPS plan which has more RAM, unfortunately. Maybe there's some config settings that I can modify to limit the RAM usage? Or, am I just out of luck?
Thanks, Steve
_______________________________________________ tor-relays mailing list tor-relays@lists.torproject.org https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-relays

On 26.02.2016 00:19, Stephen R Guglielmo wrote:
I have a VPS with 512 MB RAM. [...] The relay is an entry guard and moves about 20 MB/s.
Is that really 20 MegaByte per second? If so, I fear 512 MB RAM won't cut it. According to my experience, for a 100 Mbit/s relay you need at least 1 GB RAM.

On 02/26/2016 11:22 PM, Random Tor Node Operator wrote:
I have a VPS with 512 MB RAM. [...] The relay is an entry guard and moves about 20 MB/s. Is that really 20 MegaByte per second? If so, I fear 512 MB RAM won't cut it. According to my experience, for a 100 Mbit/s relay you need at least 1 GB RAM.
Yes, that is also my experience. -- Moritz Bartl https://www.torservers.net/
participants (10)
-
Moritz Bartl
-
Random Tor Node Operator
-
Roman Mamedov
-
s7r
-
Sean Greenslade
-
Stephen R Guglielmo
-
Steve Snyder
-
Steven Jones
-
Toralf Förster
-
Xza