nanocurrency / nano-node

Nano is digital currency. Its ticker is: XNO and its currency symbol is: Ӿ
https://nano.org
BSD 3-Clause "New" or "Revised" License
3.48k stars 786 forks source link

Print error info returned by lmdb code instead of just asserting #4391

Open dsiganos opened 7 months ago

dsiganos commented 7 months ago

Currently we assert if we receive any kind of error from lmdb, in a number of lmdb related functions. It would be useful to know what kind of error was returned to help us debug some of those asserts. We should change the functions that assert on lmdb error to print information about the error before assessing. The file is: nano/store/lmdb/transaction.cpp

We should make them print information about the error, at least the error code and any error messages that may be applicable.

The functions are (this might not be a complete list):

A related crash is: https://github.com/nanocurrency/nano-node/issues/4369

r0hanshah commented 7 months ago

I am working on this!

dsiganos commented 7 months ago

One hack for printing the lmdb error is this:

release_assert (status == MDB_SUCCESS, mdb_strerror (status));
release_assert (false && "Unable to write to the LMDB database", mdb_strerror (status));