Pages:
Author

Topic: bitcoind won't start; runs out of memory (Read 4651 times)

full member
Activity: 129
Merit: 100
August 01, 2014, 03:56:54 PM
#24
I also have txindex=1. I should've mentioned that in my original post. I don't know if that affects memory usage, but it wouldn't be surprising.
sr. member
Activity: 318
Merit: 251
August 01, 2014, 01:06:30 PM
#23
That is a lot but with that number of connections it is possible. What version are you using?

Latest version.  0.9.2.1.  Nevermind though, I actually read it wrong -- memory use it just over 1GB, so not too bad for 80 - 90 connections at any given time.  Ohhh, I also have the -txindex option turned on, so that might be doing it as well.

legendary
Activity: 1330
Merit: 1001
August 01, 2014, 06:32:48 AM
#22

Hmmm....  I just looked, and why is my bitcoind taking 2.729 GB of memory?  That's a little excessive, no?  I have 87 connections, so maybe that's why.



That is a lot but with that number of connections it is possible. What version are you using?
sr. member
Activity: 318
Merit: 251
August 01, 2014, 05:09:42 AM
#21

Hmmm....  I just looked, and why is my bitcoind taking 2.729 GB of memory?  That's a little excessive, no?  I have 87 connections, so maybe that's why.


legendary
Activity: 1358
Merit: 1001
https://gliph.me/hUF

Mine runs fine on 512 memory and 512 swap.

I had to ask the VPS operator to increase the swap space as the ways I tried wouldn't work.
newbie
Activity: 42
Merit: 0
You need far more memory than that, first of all.
legendary
Activity: 1330
Merit: 1001
Just for anybody that needs more than 1gb to run bitcoind.

This will create a 256mb swap file
sudo dd if=/dev/zero of=/swapfile bs=1024 count=256k
sudo mkswap /swapfile
sudo swapon /swapfile

This will create a 1gb swap file
sudo dd if=/dev/zero of=/swapfile bs=2048 count=512k
sudo mkswap /swapfile
sudo swapon /swapfile

If you want multiple files change /swapfile for /swapfile2
full member
Activity: 129
Merit: 100
I created a 1GB swapfile (using dd) and added it as swap space.

bitcoind runs again! Thanks!
full member
Activity: 129
Merit: 100
Thanks for the clarifications and suggestions everyone.

I tried running it with maxconnections=1, but this also ran out of memory.

I hadn't even considered creating a swap file on my own, so it wasn't a silly question at all.
I have root access, so I tried. My VPS provider was prepared:

Code:
fallocate -l 1G /swapfile
fallocate: /swapfile: fallocate failed: Operation not supported

Edit: I now realize I might be able to do this in other ways than fallocate. I'll keep working on it.
hero member
Activity: 672
Merit: 504
a.k.a. gurnec on GitHub
Thanks for the help. The VPS is running Ubuntu 12.04.4 LTS. According to free -m there is no swap space, which might be causing the problem.
Oh well. No full node for me.

Silly question perhaps, but have you tried adding swap space?

Code:
cat /proc/swaps
sudo fallocate -l 1G /swapfile
sudo chmod 600 /swapfile
sudo mkswap /swapfile
sudoedit /etc/fstab
# Add the following one line to the end of fstab, then save & exit:
/swapfile  none  swap  sw
sudo swapon -a
cat /proc/swaps

Just be aware that this might cost you $ with some VPS providers, e.g. Amazon EC2 (although it's free with others, e.g. Digital Ocean).
member
Activity: 92
Merit: 10
You have 2 options

1 - Create a swap file.
2 - Run the client using a low number of connections so it uses less ram.

Im more concerned about using in a 30 gb server... because in 2 months we will need to switch to pay the double.
staff
Activity: 4284
Merit: 8808
The UTXO set is not kept in ram, just caches. Block headers are, however... and there are various overheads related to peers and such. Beyond block headers the mempool is probably one of the biggest memory users.
donator
Activity: 1218
Merit: 1079
Gerald Davis
It has been slowly and continually increasing pretty much forever.  There is no large and significant change to the UTXO in the last week it probably was just the straw which broke the VPS's back.
full member
Activity: 129
Merit: 100
Oh well. No full node for me.

I'm curious: Does anyone know why it worked for the past 3 months, but then stopped working now? My best guess is that the main use of RAM is the utxo set. Has the number of utxo's increased recently?

legendary
Activity: 1498
Merit: 1000
You need swap, that is the problem.
full member
Activity: 129
Merit: 100
Thanks for the help. The VPS is running Ubuntu 12.04.4 LTS. According to free -m there is no swap space, which might be causing the problem.

I don't get to the point where I can call bitcoind getinfo because bitcoind -daemon is still in the initial phase before it dies. After calling bitcoind I can use top or free -m to watch the memory usage climb until it hits 1GB and dies.

hero member
Activity: 784
Merit: 500
2GB is required, and you will probably want some swap as well.

Well now that you mentioned it, my VPS had 512 MB VSwap. So yeah, OP you need to get a more robust VPS, or at least something with some VSwap.
legendary
Activity: 1498
Merit: 1000
2GB is required, and you will probably want some swap as well.
hero member
Activity: 784
Merit: 500
I don't think 1GB is enough to run Bitcoin and an OS. Currently it's using 800MB on my machine.

It's perfectly fine to run BitcoinD on a 1 GB VPS. What OS are you using, OP?
jr. member
Activity: 59
Merit: 10
For what it's worth I run a full node with 1GB RAM.  Dipping into swap a bit but it has never complained

Code:
@AOpen:~# bitcoind getinfo
{
    "version" : 90000,
    "protocolversion" : 70002,
    "walletversion" : 60000,
    "balance" : 0.00000000,
    "blocks" : 313092,
    "timeoffset" : -243,
    "connections" : 45,
    "proxy" : "",
    "difficulty" : 18736441558.31023788,
    "testnet" : false,
    "keypoololdest" : 1386727402,
    "keypoolsize" : 101,
    "paytxfee" : 0.00000000,
    "errors" : ""
}
@AOpen:~# free -m
             total       used       free     shared    buffers     cached
Mem:          1000        916         84          0         17        197
-/+ buffers/cache:        701        299
Swap:         1953        370       1583
Pages:
Jump to: