<p>Being doing my own diagnosis on this issue. I have bitcoind and lnd running on the same raspberry pi, as per the excellent Raspibolt <a href="https://stadicus.github.io/RaspiBolt/" rel="nofollow noreferrer">guide by Staticus</a>. I wrote the following script to log both daemons' cpu usage, mem usage and total number of bitcoind peers:</p>
<pre><code>#!/bin/bash
echo \
&quot;$(date +%D,%T),&quot;\
&quot;$(ps -U satoshi -o comm= -o %cpu= | grep bitcoind | awk '{print $2}'),&quot;\
&quot;$(ps -U satoshi -o comm= -o %mem= | grep bitcoind | awk '{print $2}'),&quot;\
&quot;$(ps -U satoshi -o comm= -o %cpu= | grep lnd | awk '{print $2}'),&quot;\
&quot;$(ps -U satoshi -o comm= -o %mem= | grep lnd | awk '{print $2}'),&quot;\
&quot;$(/usr/local/bin/bitcoin-cli -conf=/etc/bitcoin.conf getconnectioncount)&quot; &gt;&gt; /home/satoshi/bitcoin_connections
</code></pre>
<p>My issue may be simply allowing too many connections to my daemon. As peer count grows, mem usage does as well. When it gets to 130+ peers total system memory usage is &gt;80%. My issue may simply be an issue with running out of memory. I'll edit this post when I have more results.</p>
<p>Edit:</p>
<p>It seems that as I get to around 120-130 peers the combined mem usage of bitcoind and lnd exceed 60% of the 1 gig on my RPi, pushing total mem usage over 90%. At that point peer count drops off. I presume the daemon starts to respond very slowly as memory runs out and other peers drop mine. I set maxconnections=125 (default) and the daemon has run for weeks without issues. Since 125 is the default, the same result could be achieved by commenting out the maxconnections line in bitcoin.conf completely.</p>

CC BY-SA 4.0
2020-05-14T19:55:55.593Z
2020-06-18T14:29:39.607Z
2020-06-18T14:29:39.607Z
Mike
<p>I run bitcoind headless on a linux box with maxconnections=256 and port 8333 open on the router. Using <a href="https://github.com/Mirobit/bitcoin-node-manager" rel="nofollow noreferrer">Bitcoin Node Manager</a> I monitor node status occasionally. Peer count of course starts at 8 and slowly, over the course of three or four weeks, ramps up to 150 or so. Roughly every month or so the number of node drops precipitously to less than 20, then starts climbing again. I can verify via the logs that bitcoind did not restart and that my network did not go down. I have a second node that runs solely over TOR and while it does not have an many peer connections, its peer count doesn't fluctuate in this way.</p>

<ol>
<li><p>Does anyone else notice this?</p></li>
<li><p>Any ideas what might cause this?</p></li>
<li><p>Any tips on how (or even if) I should troubleshoot this? (i.e. things to look for in the logs)</p></li>
</ol>

CC BY-SA 4.0
2020-05-02T15:42:10.420Z
This is happening on a Raspberry Pi that is also running lnd daemon. Checking htop I saw memory usage reaching close to 100% and system response was slow. It's possible bitcoind was getting low on memory and started responding slowly, perhaps getting banned or dropped by other nodes. I've reduced dbcache in bitcoind.conf from 400 to the default, 300, for testing.
Mike
<bitcoind><network><peers>
Number of bitcoind peers drops precipitously every 30 days or so
Mike
# Number of bitcoind peers drops precipitously every 30 days or so

(Asked by: username_0 on 2020-05-01)

I run bitcoind headless on a linux box with maxconnections=256 and port 8333 open on the router. Using [Bitcoin Node Manager](https://github.com/Mirobit/bitcoin-node-manager) I monitor node status occasionally. Peer count of course starts at 8 and slowly, over the course of three or four weeks, ramps up to 150 or so. Roughly every month or so the number of node drops precipitously to less than 20, then starts climbing again. I can verify via the logs that bitcoind did not restart and that my network did not go down. I have a second node that runs solely over TOR and while it does not have an many peer connections, its peer count doesn't fluctuate in this way.

1. Does anyone else notice this?
2. Any ideas what might cause this?
3. Any tips on how (or even if) I should troubleshoot this? (i.e. things to look for in the logs)

**Tags:** bitcoind, network, peers

> **Comments:**
> **username_0**: This is happening on a Raspberry Pi that is also running lnd daemon. Checking htop I saw memory usage reaching close to 100% and system response was slow. It's possible bitcoind was getting low on memory and started responding slowly, perhaps getting banned or dropped by other nodes. I've reduced dbcache in bitcoind.conf from 400 to the default, 300, for testing.  

---

## 1 answers

### Answer by username_0 on 2020-05-14. Score: 1 | Accepted answer

Being doing my own diagnosis on this issue. I have bitcoind and lnd running on the same raspberry pi, as per the excellent Raspibolt [guide by Staticus](https://stadicus.github.io/RaspiBolt/). I wrote the following script to log both daemons' cpu usage, mem usage and total number of bitcoind peers:

```
#!/bin/bash
echo \
"$(date +%D,%T),"\
"$(ps -U satoshi -o comm= -o %cpu= | grep bitcoind | awk '{print $2}'),"\
"$(ps -U satoshi -o comm= -o %mem= | grep bitcoind | awk '{print $2}'),"\
"$(ps -U satoshi -o comm= -o %cpu= | grep lnd | awk '{print $2}'),"\
"$(ps -U satoshi -o comm= -o %mem= | grep lnd | awk '{print $2}'),"\
"$(/usr/local/bin/bitcoin-cli -conf=/etc/bitcoin.conf getconnectioncount)" >> /home/satoshi/bitcoin_connections

```

My issue may be simply allowing too many connections to my daemon. As peer count grows, mem usage does as well. When it gets to 130+ peers total system memory usage is >80%. My issue may simply be an issue with running out of memory. I'll edit this post when I have more results.

Edit:

It seems that as I get to around 120-130 peers the combined mem usage of bitcoind and lnd exceed 60% of the 1 gig on my RPi, pushing total mem usage over 90%. At that point peer count drops off. I presume the daemon starts to respond very slowly as memory runs out and other peers drop mine. I set maxconnections=125 (default) and the daemon has run for weeks without issues. Since 125 is the default, the same result could be achieved by commenting out the maxconnections line in bitcoin.conf completely.


---

