Skip to content
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

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

Open
dsiganos opened this issue Jan 23, 2024 · 2 comments
Open

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

dsiganos opened this issue Jan 23, 2024 · 2 comments
Labels

Comments

@dsiganos
Copy link
Contributor

dsiganos commented Jan 23, 2024

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):

  • nano::store::lmdb::read_transaction_impl::read_transaction_impl
  • nano::store::lmdb::read_transaction_impl::~read_transaction_impl
  • void nano::store::lmdb::read_transaction_impl::renew
  • nano::store::lmdb::write_transaction_impl::commit
  • nano::store::lmdb::write_transaction_impl::renew

A related crash is:
#4369

@r0hanshah
Copy link

I am working on this!

@dsiganos
Copy link
Contributor Author

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)); 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants