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

Slow test fixes #2799

Merged
merged 5 commits into from
Jun 4, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion nano/node/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -670,7 +670,6 @@ void nano::node::stop ()
if (!stopped.exchange (true))
{
logger.always_log ("Node stopping");
write_database_queue.stop ();
// Cancels ongoing work generation tasks, which may be blocking other threads
// No tasks may wait for work generation in I/O threads, or termination signal capturing will be unable to call node::stop()
distributed_work.stop ();
Expand Down
2 changes: 1 addition & 1 deletion nano/node/nodeconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ class node_config
nano::ipc::ipc_config ipc_config;
std::string external_address;
uint16_t external_port{ 0 };
std::chrono::milliseconds block_processor_batch_max_time{ std::chrono::milliseconds (5000) };
std::chrono::milliseconds block_processor_batch_max_time{ network_params.network.is_test_network () ? std::chrono::milliseconds (500) : std::chrono::milliseconds (5000) };
std::chrono::seconds unchecked_cutoff_time{ std::chrono::seconds (4 * 60 * 60) }; // 4 hours
/** Timeout for initiated async operations */
std::chrono::seconds tcp_io_timeout{ (network_params.network.is_test_network () && !is_sanitizer_build) ? std::chrono::seconds (5) : std::chrono::seconds (15) };
Expand Down
11 changes: 1 addition & 10 deletions nano/node/write_database_queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ nano::write_guard nano::write_database_queue::wait (nano::writer writer)
queue.push_back (writer);
}

while (!stopped && queue.front () != writer)
while (queue.front () != writer)
{
cv.wait (lk);
}
Expand Down Expand Up @@ -111,12 +111,3 @@ nano::write_guard nano::write_database_queue::pop ()
{
return write_guard (guard_finish_callback);
}

void nano::write_database_queue::stop ()
{
{
nano::lock_guard<std::mutex> guard (mutex);
stopped = true;
}
cv.notify_all ();
}
4 changes: 0 additions & 4 deletions nano/node/write_database_queue.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,14 +50,10 @@ class write_database_queue final
/** Doesn't actually pop anything until the returned write_guard is out of scope */
write_guard pop ();

/** This will release anything which is being blocked by the wait function */
void stop ();

private:
std::deque<nano::writer> queue;
std::mutex mutex;
nano::condition_variable cv;
std::function<void()> guard_finish_callback;
bool stopped{ false };
};
}
11 changes: 5 additions & 6 deletions nano/slow_test/node.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -889,7 +889,6 @@ TEST (confirmation_height, many_accounts_send_receive_self)
{
nano::keypair key;
keys.emplace_back (key);
system.wallet (0)->insert_adhoc (key.prv);

nano::send_block send (latest_genesis, key.pub, nano::genesis_amount - 1 - i, nano::test_genesis_key.prv, nano::test_genesis_key.pub, *system.work.generate (latest_genesis));
ASSERT_EQ (nano::process_result::progress, node->ledger.process (transaction, send).code);
Expand Down Expand Up @@ -931,7 +930,7 @@ TEST (confirmation_height, many_accounts_send_receive_self)
node->process_active (receive_blocks[i]);
}

system.deadline_set (200s);
system.deadline_set (300s);
num_blocks_to_confirm = num_accounts * 4;
while (node->stats.count (nano::stat::type::confirmation_height, nano::stat::detail::blocks_confirmed, nano::stat::dir::in) != num_blocks_to_confirm)
{
Expand Down Expand Up @@ -960,7 +959,7 @@ TEST (confirmation_height, many_accounts_send_receive_self)
ASSERT_NO_ERROR (system.poll ());
}

system.deadline_set (20s);
system.deadline_set (60s);
while (node->active.election_winner_details_size () > 0)
{
ASSERT_NO_ERROR (system.poll ());
Expand Down Expand Up @@ -1320,10 +1319,10 @@ TEST (node_telemetry, under_load)
nano::system system;
nano::node_config node_config (nano::get_available_port (), system.logging);
node_config.frontiers_confirmation = nano::frontiers_confirmation_mode::disabled;
auto node = system.add_node (node_config);
node_config.peering_port = nano::get_available_port ();
nano::node_flags node_flags;
node_flags.disable_ongoing_telemetry_requests = true;
node_flags.disable_initial_telemetry_requests = true;
auto node = system.add_node (node_config, node_flags);
node_config.peering_port = nano::get_available_port ();
auto node1 = system.add_node (node_config, node_flags);
nano::genesis genesis;
nano::keypair key;
Expand Down