namecoin / namecoin-legacy

Legacy client. New version here: https://github.com/namecoin/namecoin-core Note the release branch! - Official website:
https://namecoin.org
MIT License
448 stars 177 forks source link

name_filter command is failing #226

Closed muneeb-ali closed 9 years ago

muneeb-ali commented 9 years ago

With the error:

error: {"code":-1,"message":"std::bad_alloc"}

This started happening, suddenly, on a bunch of namecoind nodes (without doing any software/version updates). Any ideas re what's going on? Thanks,

domob1812 commented 9 years ago

Hm, that's interesting! Does restarting the nodes help? What do you see in the debug.log file? I suppose you are running 0.3.80?

muneeb-ali commented 9 years ago

These servers are on 0.3.76. Restarting the node sometimes helps and sometimes doesn't which is odd.

No log output in debug.log for this error. It just has the standard messages

e.g.,

error: {"code":-1,"message":"std::bad_alloc"}

and there is nothing in the log

AcceptToMemoryPool(): accepted 09394969ea sending: inv (37 bytes) sending: inv (37 bytes) sending: inv (37 bytes) sending: inv (37 bytes) sending: inv (37 bytes) sending: inv (37 bytes) sending: inv (37 bytes)

I do think this is related to the amount of memory on the server because on a couple of high-mem servers I'm not seeing the error (at least for now)

domob1812 commented 9 years ago

Note first that you should (if you can) update to 0.3.80 - there was a softfork in between. (But if you do not mine, know what you are doing and are fine with it, you can also stay on the old version.)

In that case, I guess that you simply run out of memory. The old client (not Namecoin Core) queries the whole name database into memory and then runs the regexps on it. Try switching to name_scan if that is possible for your application, using more memory or updating to Namecoin Core.

muneeb-ali commented 9 years ago

Yes, I was able to pinpoint it to a memory issue last night. Adding more memory to the VM solves it. So in Namecoin Core, you're taking some other approach to the memory management of name_filter?

domob1812 commented 9 years ago

Yes. Namecoin Core only keeps in memory what will be the final result - i. e., all names that actually match the filter. The old client first loads all names into memory and then applies the filter on them.

muneeb-ali commented 9 years ago

Got it, thanks. Closing this issue.