nano-node icon indicating copy to clipboard operation
nano-node copied to clipboard

Assert in nano::rocksdb::store::clear()

Open dsiganos opened this issue 3 years ago • 1 comments

I hit this assert whilst running a unit test.

[ RUN      ] active_transactions.fork_replacement_tally
Assertion (status.ok ()) failed
int nano::rocksdb::store::clear(rocksdb::ColumnFamilyHandle*)
/home/ds/CLionProjects/work/nano/node/rocksdb/rocksdb.cpp:602

dsiganos avatar Aug 25 '22 16:08 dsiganos

This is the function that contains the assert statement:

int nano::rocksdb::store::clear (::rocksdb::ColumnFamilyHandle * column_family)
{
	// Dropping completely removes the column
	auto name = column_family->GetName ();
	auto status = db->DropColumnFamily (column_family);
	release_assert (status.ok ());

	// Need to add it back as we just want to clear the contents
	auto handle_it = std::find_if (handles.begin (), handles.end (), [column_family] (auto & handle) {
		return handle.get () == column_family;
	});
	debug_assert (handle_it != handles.cend ());
	status = db->CreateColumnFamily (get_cf_options (name), name, &column_family);
	release_assert (status.ok ());
	handle_it->reset (column_family);
	return status.code ();
}

It appears to be deleting something and then trying to add it back again. That sounds racy... it possibly needs thread protection.

dsiganos avatar Aug 25 '22 16:08 dsiganos

This issue has been fixed by brandon-bb and can be closed @qwahzi

RickiNano avatar Oct 08 '23 19:10 RickiNano

This issue has been fixed by brandon-bb and can be closed @qwahzi

Thank you Ricki and Brandon!

qwahzi avatar Oct 08 '23 20:10 qwahzi