enable sanitizers, enable debug dump, fix memory write errors in _p2p_network->close() , fix: disable _p2p_network->close() in shutdown, because of double invoking
This commit is contained in:
parent
aa988d3fdc
commit
948624df2a
7 changed files with 23 additions and 12 deletions
|
|
@ -9,6 +9,9 @@ set( GUI_CLIENT_EXECUTABLE_NAME Peerplays )
|
|||
set( CUSTOM_URL_SCHEME "gcs" )
|
||||
set( INSTALLER_APP_ID "68ad7005-8eee-49c9-95ce-9eed97e5b347" )
|
||||
|
||||
add_compile_options(-fsanitize=address -fsanitize-recover=address)
|
||||
add_link_options(-fsanitize=address -fsanitize-recover=address -static-libasan)
|
||||
|
||||
# http://stackoverflow.com/a/18369825
|
||||
if("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
|
||||
if (CMAKE_CXX_COMPILER_VERSION VERSION_LESS 4.8)
|
||||
|
|
|
|||
|
|
@ -1009,11 +1009,10 @@ void application::shutdown_plugins() {
|
|||
return;
|
||||
}
|
||||
void application::shutdown() {
|
||||
if (my->_p2p_network)
|
||||
my->_p2p_network->close();
|
||||
//if (my->_p2p_network)
|
||||
// my->_p2p_network->close();
|
||||
if (my->_chain_db){
|
||||
my->_chain_db->close();
|
||||
my->_chain_db.reset();
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -287,6 +287,8 @@ void_result account_update_evaluator::do_apply( const account_update_operation&
|
|||
{ try {
|
||||
database& d = db();
|
||||
|
||||
d.debug_dump();
|
||||
|
||||
bool sa_before = acnt->has_special_authority();
|
||||
|
||||
// update account statistics
|
||||
|
|
|
|||
|
|
@ -50,12 +50,12 @@ void database::debug_dump()
|
|||
|
||||
for( const account_balance_object& a : balance_index )
|
||||
{
|
||||
// idump(("balance")(a));
|
||||
idump(("balance")(a));
|
||||
total_balances[a.asset_type] += a.balance;
|
||||
}
|
||||
for( const account_statistics_object& s : statistics_index )
|
||||
{
|
||||
// idump(("statistics")(s));
|
||||
idump(("statistics")(s));
|
||||
reported_core_in_orders += s.total_core_in_orders;
|
||||
}
|
||||
for( const limit_order_object& o : db.get_index_type<limit_order_index>().indices() )
|
||||
|
|
@ -86,13 +86,11 @@ void database::debug_dump()
|
|||
}
|
||||
|
||||
|
||||
/*
|
||||
const auto& vbidx = db.get_index_type<simple_index<vesting_balance_object>>();
|
||||
for( const auto& s : vbidx )
|
||||
{
|
||||
// idump(("vesting_balance")(s));
|
||||
idump(("vesting_balance")(s));
|
||||
}
|
||||
*/
|
||||
}
|
||||
|
||||
void debug_apply_update( database& db, const fc::variant_object& vo )
|
||||
|
|
|
|||
|
|
@ -89,6 +89,9 @@ void database::update_global_dynamic_data( const signed_block& b, const uint32_t
|
|||
("recently_missed",_dgp.recently_missed_count)("max_undo",GRAPHENE_MAX_UNDO_HISTORY) );
|
||||
}
|
||||
|
||||
ilog( "_dgp.head_block_number is ${head}", ("head", _dgp.head_block_number) );
|
||||
ilog( "_dgp.last_irreversible_block_num is ${lib}", ("lib", _dgp.last_irreversible_block_num) );
|
||||
|
||||
_undo_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + 1 );
|
||||
_fork_db.set_max_size( _dgp.head_block_number - _dgp.last_irreversible_block_num + 1 );
|
||||
}
|
||||
|
|
|
|||
|
|
@ -114,16 +114,16 @@ namespace graphene { namespace net {
|
|||
|
||||
void peer_database_impl::close()
|
||||
{
|
||||
std::vector<potential_peer_record> peer_records;
|
||||
peer_records.reserve(_potential_peer_set.size());
|
||||
std::copy(_potential_peer_set.begin(), _potential_peer_set.end(), std::back_inserter(peer_records));
|
||||
//std::vector<potential_peer_record> peer_records;
|
||||
//peer_records.reserve(_potential_peer_set.size());
|
||||
//std::copy(_potential_peer_set.begin(), _potential_peer_set.end(), std::back_inserter(peer_records));
|
||||
|
||||
try
|
||||
{
|
||||
fc::path peer_database_filename_dir = _peer_database_filename.parent_path();
|
||||
if (!fc::exists(peer_database_filename_dir))
|
||||
fc::create_directories(peer_database_filename_dir);
|
||||
fc::json::save_to_file( peer_records, _peer_database_filename, GRAPHENE_NET_MAX_NESTED_OBJECTS );
|
||||
fc::json::save_to_file( /*peer_records*/ _potential_peer_set, _peer_database_filename, GRAPHENE_NET_MAX_NESTED_OBJECTS );
|
||||
}
|
||||
catch (const fc::exception& e)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -664,11 +664,15 @@ BOOST_FIXTURE_TEST_CASE( cli_list_active_sons, cli_fixture )
|
|||
}
|
||||
BOOST_CHECK(generate_maintenance_block());
|
||||
|
||||
//con.wallet_api_ptr->debug_dump();
|
||||
|
||||
BOOST_TEST_MESSAGE("Voting for SONs");
|
||||
|
||||
for(unsigned int i = 1; i < son_number + 1; i++)
|
||||
{
|
||||
std::string name = "sonaccount" + fc::to_pretty_string(i);
|
||||
vote_tx = con.wallet_api_ptr->vote_for_son(name, name, true, true);
|
||||
ilog("vote_tx is ${vote_tx}", ("vote_tx", vote_tx));
|
||||
}
|
||||
BOOST_CHECK(generate_maintenance_block());
|
||||
|
||||
|
|
@ -677,6 +681,7 @@ BOOST_FIXTURE_TEST_CASE( cli_list_active_sons, cli_fixture )
|
|||
std::string name1 = "sonaccount" + fc::to_pretty_string(i);
|
||||
std::string name2 = "sonaccount" + fc::to_pretty_string(i + 1);
|
||||
vote_tx = con.wallet_api_ptr->vote_for_son(name1, name2, true, true);
|
||||
ilog("2nd_vote_tx is ${vote_tx}", ("vote_tx", vote_tx));
|
||||
}
|
||||
BOOST_CHECK(generate_maintenance_block());
|
||||
gpo = con.wallet_api_ptr->get_global_properties();
|
||||
|
|
@ -693,6 +698,7 @@ BOOST_FIXTURE_TEST_CASE( cli_list_active_sons, cli_fixture )
|
|||
}
|
||||
|
||||
BOOST_CHECK_NO_THROW(con.wallet_api_ptr->list_active_sons());
|
||||
|
||||
} catch( fc::exception& e ) {
|
||||
BOOST_TEST_MESSAGE("SON cli wallet tests exception");
|
||||
edump((e.to_detail_string()));
|
||||
|
|
|
|||
Loading…
Reference in a new issue