-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Excessive CPU usage of monero daemon with torsocks when Tor is not available #3779
Comments
I'm able to reproduce it too. Attaching a memory sample during the bug. |
What version of torsocks are you using ? |
I'm on 2.2.0 |
Weird, because it's stuck right in a recv loop. |
So there's 21 connection attempts in 15 minutes. That really still seems to be a problem with torsocks itself. |
Anyway, how do you do exactly to get into that state so I can reproduce it ? |
Also, the code in wait_on_fd seems a bit off. Try this (in torsocks):
|
monerod runs to 100% CPU and stays there forever. |
I'm unable to compile from source. If you could provide a precompiled binary for macOS I will test right away. |
#4307 has links to the build bots, there are two Mac ones (10.11 and 10.13). Click on details for the one you want, and there's a link to a tarball at the bottom of the "Steps and log files" section. |
I tested with that build and I can't reproduce there but that build appears unable to connect to the network (seeing multiple errors in the log) so I'm not sure I'm testing correctly. |
To double check this isn't something in this particular build, can the binary you were previously using connect at roughly the same time ? |
Well, now the previous one (release build) can't launch due to DB migration... I need to restore the blockchain from a backup. Will try to find some time to do that... |
Oops. You can still ceck with a temp --data-dir. |
I restored from backup but I get I tried to fix with Sigh, monerod is too buggy. I give up for now. Will try to re-sync from scratch next month when I will have some free time hopefully. |
The actual stack trace would be helpful. It'll be in the log. |
Oh, you didn't back that one up while monerod was running, right ? Because if so, it's not monerod that's buggy, it's your backup script :) |
Excessive CPU usage of monero daemon with torsocks when the Tor proxy is not available. Tested on Tails 3.6.2 and OpenBSD amd64 with Monero v0.12.0.0. Tested on Tails with cli binaries from getmonero.org.
When the Tor proxy is not available the monerod process will consume a lot of CPU power. When you enable the Tor proxy it will drop to normal levels, even when the Tor proxy is not connected to the Tor network. CPU usage will jump back up when you stop the Tor proxy again.
The --detach and --non-interactive options are also affected by this issue.
The following data is from an OpenBSD amd64 system with Monero v0.12.0.0 and torsocks 2.2.0. The monerod daemon system is configured with ip address 172.16.1.2 and is able to communicate with 172.16.1.1. There is no Tor, DNS or Monero daemon service running on 172.16.1.1. The daemon is bootstrapping from scratch.
Results:
100% CPU usage on 1 core:
TORSOCKS_ALLOW_INBOUND=1 /usr/local/bin/torsocks /usr/local/bin/monerod
Less then 1% CPU usage:
TORSOCKS_ALLOW_INBOUND=1 /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=127.0.0.1
TORSOCKS_ALLOW_INBOUND=1 /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=172.16.1.1
100% CPU usage on 1 core:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp /usr/local/bin/torsocks /usr/local/bin/monerod
Less then 1% CPU usage:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=127.0.0.1
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=172.16.1.1
80-90% CPU usage on 1 core:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://127.0.0.1 /usr/local/bin/torsocks /usr/local/bin/monerod
Less then 1% CPU usage:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://127.0.0.1 /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=127.0.0.1
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://127.0.0.1 /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=172.16.1.1
100% CPU usage on 1 core:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://172.16.1.1 /usr/local/bin/torsocks /usr/local/bin/monerod
Less then 1% CPU usage:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://172.16.1.1 /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=127.0.0.1
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://172.16.1.1 /usr/local/bin/torsocks /usr/local/bin/monerod --add-exclusive-node=172.16.1.1
100% CPU usage on more then 4 cores. 9 tcp connections. Very slow response to the stop signal in detach and non-interactive mode:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp /usr/local/bin/torsocks --address 172.16.1.1 /usr/local/bin/monerod
100% CPU usage on 4 cores. 4 tcp connections. Very slow response to the stop signal in detach and non-interactive mode:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp /usr/local/bin/torsocks --address 172.16.1.1 /usr/local/bin/monerod --add-exclusive-node=127.0.0.1
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp /usr/local/bin/torsocks --address 172.16.1.1 /usr/local/bin/monerod --add-exclusive-node=172.16.1.1
100% CPU usage on more then 4 cores. 9 tcp connections. Very slow response to the stop signal in detach and non-interactive mode:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://172.16.1.1 /usr/local/bin/torsocks --address 172.16.1.1 /usr/local/bin/monerod
100% CPU usage on 4 cores. 4 tcp connections. Very slow response to the stop signal in detach and non-interactive mode:
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://172.16.1.1 /usr/local/bin/torsocks --address 172.16.1.1 /usr/local/bin/monerod --add-exclusive-node=127.0.0.1
TORSOCKS_ALLOW_INBOUND=1 DNS_PUBLIC=tcp://172.16.1.1 /usr/local/bin/torsocks --address 172.16.1.1 /usr/local/bin/monerod --add-exclusive-node=172.16.1.1
The text was updated successfully, but these errors were encountered: