-
Notifications
You must be signed in to change notification settings - Fork 648
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
Out of memory in long term runs #412
Comments
Same issue here. |
What version were you running when you got the out-of-memory error? |
0.31.0 |
There isn't a bitcore-node version 0.31.0 |
Sorry, looked at the wrong number. I'm newbie with these, I'm currently trying to look how to upgrade the software, how can I look up the version number? |
bitcore-node --version prints out undefined for me |
We should add an |
@braydonf For me you can consider it to be always the latest version. |
Btw. bitcore runs round about 20 to 30 days before crashing. The used memory grows to a size of about just 6 to 8GiB before it crashes. |
It may be worth checking the size of the mempool near that point with the bitcoin-cli utility:
|
@kangasbros You can find the version in the installed |
My versions: { |
And here you go, some logs from the crash:
|
SatoshiPay has the same issues. I ran some analysis of the heap and see that a lot of RAM is allocated in this function: https://github.com/bitpay/bitcore-node/blob/master/lib/services/address/index.js#L304 and used for the "mempoolSpentIndex" Array. I kinda suspect that indices are added to the "mempoolSpentIndex" Array here https://github.com/bitpay/bitcore-node/blob/master/lib/services/address/index.js#L372 but the "delete" part is never triggered or just plainly does not work. Another reason could be "transactions stuck in mempool". They will trigger an item to be added to the array which will never be removed, right? @braydonf Should be able to answer this as these are his changes from Oct 2015 89ef28f |
BTW, we're moving to keep the address index in bitcoind, and these indexes here won't be needed. See: https://github.com/bitpay/bitcoin/pull/6/files#diff-ca74c4b28865382863b8fe7633a85cd6R420 and #422 |
This is a big PR. When will it be merged? Why dont you have more prs and smallers ones? Who can proof read all this? |
It may seem like that but the code base is quite small considering, most of the new code is at: https://github.com/braydonf/bitcore-node/blob/bitcoind/lib/services/bitcoind.js with corresponding docs here: https://github.com/braydonf/bitcore-node/blob/bitcoind/docs/services/bitcoind.md |
And another one FATAL ERROR: CALL_AND_RETRY_LAST Allocation failed - process out of memory
<--- Last few GCs --->
635316153 ms: Scavenge 1387.5 (1439.0) -> 1387.5 (1440.0) MB, 1.2 / 0 ms (+ 5.7 ms in 1 steps since last GC) [allocation failure] [incremental marking delaying mark-sweep].
635317676 ms: Mark-sweep 1387.5 (1440.0) -> 1356.2 (1440.0) MB, 1523.3 / 0 ms (+ 386.9 ms in 1284 steps since start of marking, biggest step 6.0 ms) [last resort gc].
635319202 ms: Mark-sweep 1356.2 (1440.0) -> 1362.7 (1415.0) MB, 1525.2 / 0 ms [last resort gc].
<--- JS stacktrace --->
==== JS stack trace =========================================
Security context: 0x2056d6cb4629 <JS Object>
1: DELETE [native runtime.js:350] [pc=0x2360d4c5dd71] (this=0xf3f2c9140b1 <an Object with map 0x3a55150f31e9>,q=0x283659fd38d9 <String[36]\: \xb2\xbec*;\xf15\x86+\xe8\xb3\xea\xbe\xe0g\x98\x98\xed\x8du\xd7\xfb\xb0\xd8\x0f\xc7c\xa0\xf5\xdd\x06x\x00\x00\x00\x01>,r=1)
2: updateMempoolIndex [/home/bt2/bitcore-node/lib/services/address/index.js:~283] [pc=0x2360db5311d6] (this=0x26b08e7ec951 <... |
I'm seeing what appears to be a leak in Perhaps it's actually a bitcoind leak. |
If you have the means, try @braydonf #422 branch. What we are planning for bitcore (bitcore-node) is to remove the static library patch and spawn bitcoind as a subprocess of bitcore. This way we can optimize bitcoind with respect to memory use and performance and send those fixes upstream without introducing controversy over making bitcoind a proper shared library. We could not get 100% consensus over making bitcoind a shared library (libbitcoind.a/libbitcoind.so) even though the patch was very basic (removing main() and patching Makefile.am. So now, if you STILL get leaks, then, guaranteed this is bitcoind and can't be related to bitcore-node. I've done extensive testing using valgrind and friends and detected leaks in bitcoind, but nothing that I was too worried about fixing. |
Another crash:
I will also take a look at @braydonf branch. |
Any news on this? We need a fix @satoshipay. |
@levino, #422 has been merged and released. Though we should still do deeper memory leak inspection and checking (if there still are any issues). FYI, it looks like @chjj fixed a couple of memory leaks in leveldown recently (Level/leveldown#264 and Level/leveldown#267) and could have been related. It's not relevant to the latest release as both levelup and leveldown are no longer dependencies, since leveldb in bitcoind is used instead. This is still good news since leveldown still useful for other purposes. |
I'm currently on the 3.0.0 and it crashed again unfortunately no logs in the bitcoind logs neither in the bitcore-node.log file. I update now to the 3.0.2 |
In regards to running a daemon: Since upstart/systemd manages log rotation and process management (keeping track of the pid, restarting, and etc) it's the recommended method to run as a daemon, see https://bitcore.io/guides/upstart-daemon. |
Ok good to know, you should remove the -d --daemon description from the help dialogue if it was removed. |
Thanks, didn't realize it was still there, updated in #461 |
We came around to merging in the changes and as of today we use bitcore-node@3.0.2 @satoshipay. So far it is looking good. Will update on the matter in a week when hopefully everything remained stable. |
No problem! FYI, had a 3.0.0 node running from 2016-06-14 to 2016-07-07 without any issues. |
Something else: Sync is really io heavy now. Got the impression this is due to bitcoind creating many more indices. But it is hefty. Takes a week to sync and index on a dedicated machine (with somewhat slow disks though) |
I don't think there are any issue here still, please let us know if there any other problems. |
It seems like there still are some memory problems, after about a month bitcore node crashes with the following message:
Details about the setup:
Bitcore Node now runs now on a machine with 64GiB dedicated RAM and has about 100 to 200 connections open at the same time. Currently it also allows up to 500 connections to be opened at the same time.
Additional config settings are:
minrelaytxfee=0.00002
limitfreerelay=70
maxconnections=500
Unfortunately I do not have anything else for you yet, if you want something specific let me know and I will post it on the next crash.
The text was updated successfully, but these errors were encountered: