bitcoind crashing due to insufficient memory?

2

1

EDIT 3

Bumping my VPS to 1GB of physical RAM stopped the crashing issue... UNTIL said VPS ran out of disc space.

I added prune=10240 to my ~/.bitcoin/bitcoin.conf file such that the blockchain file would start pruning transaction history upon reaching 10GB filesize (1024 MB * 10 = 10GB).

EDIT 2

This seems to be a memory issue, not a VPN networking issue. I turned OpenVPN off and restarted bitcoind only to see it silently crash again.

I've now added a 1GB swapfile to expand the available memory space (risk is this will cause performance issues for the OS). Will update once again if this solves the issue. If not, I will probably end up trying to upgrade the VPS instance to 1GB of physical RAM from 512MB.


EDIT Found some interesting stuff in the log relating to tor...

root@sf-vps:~# cat ~/.bitcoin/debug.log | grep tor -i 2016-11-13 16:52:21 Default data directory /root/.bitcoin 2016-11-13 16:52:21 Using data directory /root/.bitcoin 2016-11-13 16:52:21 Using at most 125 connections (1024 file descriptors available) 2016-11-13 16:52:29 torcontrol thread start 2016-11-13 17:08:43 Default data directory /root/.bitcoin 2016-11-13 17:08:43 Using data directory /root/.bitcoin 2016-11-13 17:08:43 Using at most 125 connections (1024 file descriptors available) 2016-11-13 17:08:50 torcontrol thread start 2016-11-13 17:08:50 tor: Error connecting to Tor control socket 2016-11-13 17:08:50 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect 2016-11-13 17:08:51 tor: Error connecting to Tor control socket 2016-11-13 17:08:51 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect 2016-11-13 17:08:52 tor: Error connecting to Tor control socket 2016-11-13 17:08:52 tor: Not connected to Tor control port 127.0.0.1:9051, trying to reconnect


I've installed the Bitcoin software on Ubuntu 16.04. I'm able to run bitcoind -daemon for a few minutes, but after a while the process crashes.

Interestingly, I don't see any reasons in ~/.bitcoin/debug.log explaining why the program might have terminated.

I suspect a couple of things:

  1. Not enough disc space to store the entire blockchain. However, I don't think this is the case as running df - h shows a combined total of only ~41% disc consumption:

root@sf-vps:~# df -h Filesystem Size Used Avail Use% Mounted on udev 241M 0 241M 0% /dev tmpfs 50M 3.1M 47M 7% /run /dev/vda1 20G 6.3G 13G 34% / tmpfs 247M 0 247M 0% /dev/shm tmpfs 5.0M 0 5.0M 0% /run/lock tmpfs 247M 0 247M 0% /sys/fs/cgroup tmpfs 50M 0 50M 0% /run/user/0

  1. Server is not able to receive inbound messages as I'm running a VPN. Is it possible that I'm experiencing a networking issue, e.g. inbound traffic to port 8333 (the default for bitcoind) is not being allowed through my VPN? I can't remember how to change the VPN config to allow connections on specific ports, but that's where I'm looking next...

root@sf-vps:~# netstat -nr Kernel IP routing table Destination Gateway Genmask Flags MSS Window irtt Iface 0.0.0.0 159.203.240.1 0.0.0.0 UG 0 0 0 eth0 10.8.0.0 10.8.0.2 255.255.255.0 UG 0 0 0 tun0 10.8.0.2 0.0.0.0 255.255.255.255 UH 0 0 0 tun0 10.12.0.0 0.0.0.0 255.255.0.0 U 0 0 0 eth0 159.203.240.0 0.0.0.0 255.255.240.0 U 0 0 0 eth0 Thanks in advance for your help :)

mecampbellsoup

Posted 2016-11-13T17:16:01.023

Reputation: 184

1How much memory? Bitcoind needs around 1 GB of free RAM.Pieter Wuille 2016-11-13T17:18:00.063

@PieterWuille I have 512MB physical memory in the instance. I created a swap file with 1GB of virtual memory (believe I'm using these terms correctly here). It lasted a little longer after turning the swapfile on (swapon /swapfile) but crashed once again. Perhaps I just need a beefier VPS?mecampbellsoup 2016-11-14T17:36:13.917

2Yes, you definitely need more memory.Pieter Wuille 2016-11-14T17:59:10.337

1Read your system logfiles (/var/log/syslog). If the system runs out of memory and kills bitcoind, you'll see it logged there. It may also be helpful to run bitcoind without -daemon as a test; it will be easier to see what happens when it dies.Nate Eldredge 2016-11-14T19:20:30.597

@PieterWuille would adjusting any of the following configuration options reduce the memory footprint consumed by bitcoind: disablewallet, dbcache, prune, maxorphantx, maxmempool?mecampbellsoup 2016-11-15T13:46:45.817

3

Possible duplicate of How to run bitcoind in a low memory environment

Pieter Wuille 2017-02-13T02:19:49.030

Answers

0

Are you sure 9051 is the right port for tor? 9050 is the default port. You can check it by using sudo netstat -plnt | grep ':9051'.

And is the tor service active?

When it still doesn't works try disabling selinux(If you are running linux). I had some problems with tor because selinux was blocking it. But don't forget to put it back on. If it is selinux you can make a rule for tor/bitcoin in selinux.

Jan Wytze

Posted 2016-11-13T17:16:01.023

Reputation: 289

3Not having a network connection will not crash bitcoind. Only a hardware problem, a bug, or memory exhaustion can.Pieter Wuille 2016-11-13T23:55:48.160