Merge pull request #4719 from clemahieu/tsan_fixes
Fix correctness, sanity check, and resolve shutdown issue.
This commit is contained in:
commit
b362c7ca40
5 changed files with 19 additions and 7 deletions
|
@ -506,6 +506,7 @@ bool nano::active_elections::erase (nano::qualified_root const & root_a)
|
|||
auto root_it (roots.get<tag_root> ().find (root_a));
|
||||
if (root_it != roots.get<tag_root> ().end ())
|
||||
{
|
||||
release_assert (root_it->election->qualified_root == root_a);
|
||||
cleanup_election (lock, root_it->election);
|
||||
return true;
|
||||
}
|
||||
|
|
|
@ -132,11 +132,15 @@ void nano::confirming_set::run_batch (std::unique_lock<std::mutex> & lock)
|
|||
notification.cemented.swap (cemented);
|
||||
notification.already_cemented.swap (already);
|
||||
|
||||
// Wait for the worker thread if too many notifications are queued
|
||||
std::unique_lock lock{ mutex };
|
||||
while (notification_workers.num_queued_tasks () >= config.max_queued_notifications)
|
||||
{
|
||||
stats.inc (nano::stat::type::confirming_set, nano::stat::detail::cooldown);
|
||||
std::this_thread::sleep_for (100ms);
|
||||
condition.wait_for (lock, 100ms, [this] { return stopped; });
|
||||
if (stopped)
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
notification_workers.push_task ([this, notification = std::move (notification)] () {
|
||||
|
|
|
@ -452,8 +452,9 @@ std::vector<nano::representative> nano::rep_crawler::representatives (std::size_
|
|||
}
|
||||
|
||||
std::vector<nano::representative> result;
|
||||
for (auto const & [weight, rep] : ordered | std::views::take (count))
|
||||
for (auto i = ordered.begin (), n = ordered.end (); i != n && result.size () < count; ++i)
|
||||
{
|
||||
auto const & [weight, rep] = *i;
|
||||
result.push_back ({ rep.account, rep.channel });
|
||||
}
|
||||
return result;
|
||||
|
|
|
@ -168,10 +168,14 @@ void nano::unchecked_map::query_impl (nano::block_hash const & hash)
|
|||
|
||||
std::unique_ptr<nano::container_info_component> nano::unchecked_map::collect_container_info (const std::string & name)
|
||||
{
|
||||
nano::lock_guard<nano::mutex> lock{ mutex };
|
||||
|
||||
auto composite = std::make_unique<container_info_composite> (name);
|
||||
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "entries", entries.size (), sizeof (decltype (entries)::value_type) }));
|
||||
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "queries", buffer.size (), sizeof (decltype (buffer)::value_type) }));
|
||||
{
|
||||
std::lock_guard guard{ entries_mutex };
|
||||
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "entries", entries.size (), sizeof (decltype (entries)::value_type) }));
|
||||
}
|
||||
{
|
||||
nano::lock_guard<nano::mutex> lock{ mutex };
|
||||
composite->add_component (std::make_unique<container_info_leaf> (container_info{ "queries", buffer.size (), sizeof (decltype (buffer)::value_type) }));
|
||||
}
|
||||
return composite;
|
||||
}
|
||||
|
|
|
@ -2,3 +2,5 @@ race:mdb.c
|
|||
race:rocksdb
|
||||
race:Rijndael::Base::FillEncTable
|
||||
race:Rijndael::Base::FillDecTable
|
||||
race:CryptoPP::Rijndael
|
||||
race:boost::asio::detail::conditionally_enabled_mutex::scoped_lock::scoped_lock
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue