-
Notifications
You must be signed in to change notification settings - Fork 35.7k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
bitcoin-qt out-of-virtual-address-space problem #2353
Comments
bad_alloc means it is running out of memory. How much memory do you have? What OS? |
magnus@desktop|21:59|~/src/bitcoin ((v0.8.0)) $ cat /proc/meminfo I'm running Lubuntu 12.04, 32 bit. |
This is how bitcoin runs out of memory (virtual address space) while downloading blocks: Whenever a node receives a block that it cannot link to the chain, it stores it in memory in mapOrphanBlocks. There is no limit to the size of that data. When a node is downloading blocks, it may download and keep in memory many blocks that it can't currently link to the chain. In particular, if your node connects to another node which is also downloading blocks and which is further along in the download, the other node will spam your node with an "inv" message for every new block that it downloads (no, the logic in CBlock::AcceptBlock does not prevent it), and your node will download and store those blocks in mapOrphanBlocks. This can occur with multiple connected nodes simultaneously which are at different points in the download. I encountered this problem several times with 0.8.0rc1. With the current size of the blockchain, it is not hard to exhaust the virtual address space (at most 4GiB) in 32-bit builds, which includes all Windows builds. The fix could proceed in one of two directions: (1) store orphan blocks on disk instead of in memory, or (2) don't keep an unbounded set of orphan blocks. For (2), the ideal would be to prevent downloading of too many orphans rather than discarding orphans that have already been downloaded, which is wasteful. The goal would be to download blocks roughly in order. One idea is to make use of "getheaders" during block download. Headers would be downloaded and linked together, and blocks would only be downloaded if we already know based on headers that they are not too far away from the chain of blocks that we already have. |
Headers-first synchronization (being worked on) removes the concept of orphan blocks entirely, as a block is only downloaded when its ancestry is already known, so it can always be saved on disk. |
Since 0.9.0 the number of orphan blocks that is stored has been restricted, so this immediate issue should be fixed. |
EXCEPTION: St9bad_alloc
std::bad_alloc
bitcoin in ProcessMessages()
EXCEPTION: St9bad_alloc
std::bad_alloc
bitcoin in ThreadMessageHandler()
terminate called after throwing an instance of 'std::bad_alloc'
what(): std::bad_alloc
Aborted
The only thing I did was to wipe everything clean and start version 0.8.0. It started to download the block chain for a while and when I got back home it was dead. Is there anything I can do to prepare myself so I can gather more information if it happens again? Thinking of crash dumps, logs etc.
The text was updated successfully, but these errors were encountered: