RPC
Issue
So, as you all know I have been running a witness node as well RPC node, today we got some errors and most of the users were having two issues
- Unable to claim blurt from wallet
- Unable to vote
Below is the image for error by @freakeao
So, what this error means?
Basically, this says, the RPC node does not have enough memory to call plugin functions. (Bad C++ memory management in blockchain plugin)
This memory is related to a memory file not about RAM as this issue happened at both 8GB and 16GB ram servers.
Basically, there is a shared_memory.bin file that works as a swap memory for all blockchain operations.
root@vmi7654:/var/lib/docker/volumes/blurtd/_data/blockchain# ls -lsh
total 12G
9.9G -rw-r--r-- 1 tekraze tekraze 9.9G Dec 7 21:02 block_log
113M -rw-r--r-- 1 root root 113M Dec 7 21:02 block_log.index
1.9G -rw-r--r-- 1 root root 8.0G Dec 7 21:02 shared_memory.bin
Because of this file filling up, no more free memory is available for further operations, which leads to the previous errors.
Solution
There are two properties, that need to be changed in config.ini under blurtd/_data directory
Check below image for the properties.
Now setting it to different values, as below
shared-file-full-threshold = 9900
shared-file-scale-rate = 1000
So, what we done here, we set threshold at 9900, means if the memory is used up 99% then its time to scale. Scale rate of 1000 means, increase memory file by 10% when scaling is done.
After saving the changes in the file changes, just restart your blurt rpc.
docker restart id
or
docker restart blurtrpc
Just add either docker container id or container name here to restart.
Just wait for sync and check logs, it may take some time.
docker logs blurtrpc -f
To confirm dynamic scaling you can check logs, or check the size of the file again as we did before.
Here is a sample log of scaling in RPC
2445557ms database.cpp:2747 check_free_memory ] Memory is almost full, increasing to 16482M
2445951ms database.cpp:2752 check_free_memory ] Free memory is now 181M
So, congrats now you can maintain your RPC and make it work in case memory is filled up.
If you need to setup a RPC server, check the guide here https://blurt.blog/blurtdevelopment/@tekraze/rpc-guide-dev-updates-and-swap-blurt-or-devlog-14-or-29-nov-2021
That was all for today, I will keep on sharing more updates as they come, Have a happy blurt blogging.
I would love to have a vote from you as a witness from me
https://blurtwallet.com/~witnesses?highlight=tekraze
Follow me on my social networks
Tekraze Blog
Instagram Personal
Instagram Blog account
Instagram Gaming Account
Youtube Gaming
DTube
Tekraze on Medium
Dehazelabs on Medium
Dev.to
Hashnode
Noise
Hive
Steemit
#iduvts I don't use any upvote services
Cross Posted from https://blurt.blog/blurtdevelopment/@tekraze/quick-rpc-fix-for-memory-issue-or-devlog-16-or-07-december-2021