Xmrig proxy read error: "connection reset by peer"

Started by wowfans, Sep 27, 2021, 01:51 AM

Previous topic - Next topic

wowfans


When xmrig proxy runs for a period of time (maybe several hours), an error will occur.

orklemerkle

What OS are you using? Can you see if `wownerod` is still running, and see if there's anything in the logs?

wowfans

My xmrig proxy and wownerod are running on a ubuntu computer, no error message is found on the wownerod, only timeout appears on the xmrig proxy

orklemerkle

What does the onset of the errors look like? Does `xmrig-proxy` begin getting intermittent errors, or does it appear as a storm as in your screenshot immediately?

What is the system load like (load, memory, CPU)?

Right now I still don't have a handle on what the problem is, but this info might help someone else work it out.

wowfans

Mining will continue, but there will be 1-10 connection timeouts every few minutes. Even if there are errors, it seems that miners can still mine.

wowfans

At the beginning, the xmrig agent will print normal output. After a period of time has passed, connection timeouts will appear intermittently, about once every 2-3 minutes.

orklemerkle

Quote from: "wowfans, post:5, topic:944, full:true"Mining will continue, but there will be 1-10 connection timeouts every few minutes. Even if there are errors, it seems that miners can still mine.

This is expected. As long as miners remain connected to the proxy, they will continue to mine the last block. You do run the risk of mining a stale block or not being able to submit a block while `xmrig-proxy` and `wownerod` are not talking, though.

Quote from: "wowfans, post:6, topic:944, full:true"At the beginning, the xmrig agent will print normal output. After a period of time has passed, connection timeouts will appear intermittently, about once every 2-3 minutes.

Do you have a firewall on your machine? What does `iptables -v -S` (as root) show? (The `-v` flag will also show connection/byte counters. We want to see whether `conntrack` or other rules are applied before loopback traffic is `ACCEPT`ed.)

Do any other software on the same machine suffer from the same errors? Is your machine handling lots of connections?

wowfans

The screen output of executing ```iptables -v -S```

orklemerkle

Okay, the firewall is no problem. Let's see your number of open connections and kernel tunables:

    netstat -tn | wc -l
    netstat -ltn | wc -l
    cat /proc/sys/net/ipv4/ip_local_port_range
    cat /proc/sys/net/ipv4/tcp_fin_timeout
    cat /proc/sys/net/ipv4/tcp_max_syn_backlog
    cat /proc/sys/net/core/netdev_max_backlog
    cat /proc/sys/net/core/somaxconn

wowfans


orklemerkle

It looks like your server has too many connections open, which could explain the random connection timeouts. Try increasing your local port range, for example:

    sysctl -w net.ipv4.ip_local_port_range="16384 64000"

This tunable sets the range of ports that can be used as the local end of outgoing TCP connections. Make sure that the range does not include any server ports you have (see `netstat -ltn` for a list). The highest possible port number is 65535.

Ideally, the range should contain enough ports for all your outgoing connections (a localhost connection count as both outgoing and incoming).

orklemerkle

Also try increasing the maximum incoming connections:

    sysctl -w net.ipv4.tcp_max_syn_backlog=256
    sysctl -w net.core.somaxconn=4096

These increase the length of the queues of incoming connections that haven't been accepted by listening processes.

Your server looks very busy; it might help to move either `xmrig-proxy` or `wownerod` to a more lightly-loaded server. Or you may have a runaway process of some kind.

wowfans

I revised it as you said, and the problem was solved. To thank you, I can send you some WOW, and you can give me your wallet address.

orklemerkle

I'm glad it worked out. To persist the config across reboots, add these lines to `/etc/sysctl.conf`:

```
net.ipv4.ip_local_port_range="16384 64000"
net.ipv4.tcp_max_syn_backlog=256
net.core.somaxconn=4096
```

Expect a DM sometime soon.

wowfans

I checked and found that 34568 occupies too many socket connections (more than 20,000). Is this normal?