Bitcoin Forum
May 09, 2024, 12:10:23 AM *
News: Latest Bitcoin Core release: 27.0 [Torrent]
 
   Home   Help Search Login Register More  
Pages: [1] 2 »  All
  Print  
Author Topic: bitcoind won't start; runs out of memory  (Read 4620 times)
Krona Rev (OP)
Full Member
***
Offline Offline

Activity: 129
Merit: 100



View Profile
July 29, 2014, 08:30:49 PM
 #1

I've been running bitcoind on a VPS for a few months. A few days ago it crashed. Since then every time I restart it it runs out of memory within a minute or two. The VPS has 1GB of RAM and I'm not running anything else. Here is exactly what it says:

Code:
************************
EXCEPTION: St9bad_alloc       
std::bad_alloc       
bitcoin in AppInit()       

terminate called after throwing an instance of 'std::bad_alloc'
  what():  std::bad_alloc

The last time I was successfully running it I had version 0.9.1. When it wouldn't restart I upgraded to 0.9.2.1, but the same thing happens.

Can anyone help? Thanks!

Promechard: Proprietary Metablock Chains for Arbitrary Data: https://bitcointalk.org/index.php?topic=411974.0
1715213423
Hero Member
*
Offline Offline

Posts: 1715213423

View Profile Personal Message (Offline)

Ignore
1715213423
Reply with quote  #2

1715213423
Report to moderator
1715213423
Hero Member
*
Offline Offline

Posts: 1715213423

View Profile Personal Message (Offline)

Ignore
1715213423
Reply with quote  #2

1715213423
Report to moderator
1715213423
Hero Member
*
Offline Offline

Posts: 1715213423

View Profile Personal Message (Offline)

Ignore
1715213423
Reply with quote  #2

1715213423
Report to moderator
TalkImg was created especially for hosting images on bitcointalk.org: try it next time you want to post an image
Advertised sites are not endorsed by the Bitcoin Forum. They may be unsafe, untrustworthy, or illegal in your jurisdiction.
1715213423
Hero Member
*
Offline Offline

Posts: 1715213423

View Profile Personal Message (Offline)

Ignore
1715213423
Reply with quote  #2

1715213423
Report to moderator
Challisto
Newbie
*
Offline Offline

Activity: 13
Merit: 0


View Profile
July 29, 2014, 08:38:57 PM
 #2

I don't think 1GB is enough to run Bitcoin and an OS. Currently it's using 800MB on my machine.
Krona Rev (OP)
Full Member
***
Offline Offline

Activity: 129
Merit: 100



View Profile
July 29, 2014, 08:50:42 PM
 #3

If 1GB RAM isn't enough, I'll probably just give up the VPS and stop running a node. That would be a shame.

Promechard: Proprietary Metablock Chains for Arbitrary Data: https://bitcointalk.org/index.php?topic=411974.0
shorena
Copper Member
Legendary
*
Offline Offline

Activity: 1498
Merit: 1520


No I dont escrow anymore.


View Profile WWW
July 29, 2014, 09:45:10 PM
 #4

I have an 2Gig machine that runs a node just fine, its on win7 and testnet though. But I cant imagine that 1 gig shouldnt be enough.

Can you check how much ram (according to the OS) was used, how many connections where open and whether or not the VM actually gave you a full gig at the time of the crash?

It might just be bad VMWare running in the background.

Im not really here, its just your imagination.
oldbute
Jr. Member
*
Offline Offline

Activity: 59
Merit: 10


View Profile
July 30, 2014, 02:42:19 AM
 #5

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
AuroraHF
Hero Member
*****
Offline Offline

Activity: 784
Merit: 500


View Profile
July 30, 2014, 02:44:21 AM
 #6

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?

lmao
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
July 30, 2014, 02:50:00 AM
 #7

2GB is required, and you will probably want some swap as well.
AuroraHF
Hero Member
*****
Offline Offline

Activity: 784
Merit: 500


View Profile
July 30, 2014, 02:51:45 AM
 #8

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.

lmao
Krona Rev (OP)
Full Member
***
Offline Offline

Activity: 129
Merit: 100



View Profile
July 30, 2014, 06:32:11 AM
 #9

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.


Promechard: Proprietary Metablock Chains for Arbitrary Data: https://bitcointalk.org/index.php?topic=411974.0
gweedo
Legendary
*
Offline Offline

Activity: 1498
Merit: 1000


View Profile
July 30, 2014, 06:37:16 AM
 #10

You need swap, that is the problem.
Krona Rev (OP)
Full Member
***
Offline Offline

Activity: 129
Merit: 100



View Profile
July 30, 2014, 05:10:09 PM
 #11

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?


Promechard: Proprietary Metablock Chains for Arbitrary Data: https://bitcointalk.org/index.php?topic=411974.0
DeathAndTaxes
Donator
Legendary
*
Offline Offline

Activity: 1218
Merit: 1079


Gerald Davis


View Profile
July 30, 2014, 05:51:35 PM
 #12

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.
gmaxwell
Moderator
Legendary
*
expert
Offline Offline

Activity: 4172
Merit: 8418



View Profile WWW
July 30, 2014, 06:50:06 PM
 #13

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.
ponzigo
Member
**
Offline Offline

Activity: 92
Merit: 10


View Profile
July 30, 2014, 07:08:33 PM
 #14

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.

Don't bring to bitcointalk your shitty scams. I'll try them and tell the truth.
btchris
Hero Member
*****
Offline Offline

Activity: 672
Merit: 504

a.k.a. gurnec on GitHub


View Profile WWW
July 30, 2014, 07:18:29 PM
 #15

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).
Krona Rev (OP)
Full Member
***
Offline Offline

Activity: 129
Merit: 100



View Profile
July 30, 2014, 07:51:50 PM
 #16

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.

Promechard: Proprietary Metablock Chains for Arbitrary Data: https://bitcointalk.org/index.php?topic=411974.0
Krona Rev (OP)
Full Member
***
Offline Offline

Activity: 129
Merit: 100



View Profile
July 30, 2014, 08:09:23 PM
 #17

I created a 1GB swapfile (using dd) and added it as swap space.

bitcoind runs again! Thanks!

Promechard: Proprietary Metablock Chains for Arbitrary Data: https://bitcointalk.org/index.php?topic=411974.0
rz20
Legendary
*
Offline Offline

Activity: 1330
Merit: 1001


View Profile
July 30, 2014, 08:35:48 PM
 #18

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
codegeek
Newbie
*
Offline Offline

Activity: 42
Merit: 0


View Profile
July 30, 2014, 09:48:40 PM
 #19

You need far more memory than that, first of all.
Newar
Legendary
*
Offline Offline

Activity: 1358
Merit: 1001


https://gliph.me/hUF


View Profile
July 31, 2014, 02:36:41 AM
 #20


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.

OTC rating | GPG keyid 1DC91318EE785FDE | Gliph: lightning bicycle tree music | Mycelium, a swift & secure Bitcoin client for Android | LocalBitcoins
Pages: [1] 2 »  All
  Print  
 
Jump to:  

Powered by MySQL Powered by PHP Powered by SMF 1.1.19 | SMF © 2006-2009, Simple Machines Valid XHTML 1.0! Valid CSS!