Skip to content

Commit

Permalink
Increase tcp_io_timeout for test TSAN/ASAN builds (#2019)
Browse files Browse the repository at this point in the history
Fixing TSAN node.vote_replay test
  • Loading branch information
SergiySW authored May 25, 2019
1 parent 9e7d2c0 commit 75052a6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion nano/core_test/network.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2157,7 +2157,7 @@ TEST (bootstrap, tcp_listener_timeout_node_id_handshake)
ASSERT_EQ (node0->bootstrap.connections.size (), 1);
}
bool disconnected (false);
system.deadline_set (std::chrono::seconds (10));
system.deadline_set (std::chrono::seconds (20));
while (!disconnected)
{
{
Expand Down
18 changes: 11 additions & 7 deletions nano/lib/config.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,16 @@
*/
static const char * NANO_MAJOR_MINOR_VERSION = xstr (NANO_VERSION_MAJOR) "." xstr (NANO_VERSION_MINOR);
static const char * NANO_MAJOR_MINOR_RC_VERSION = xstr (NANO_VERSION_MAJOR) "." xstr (NANO_VERSION_MINOR) "RC" xstr (NANO_VERSION_PATCH);
/** Is TSAN/ASAN test build */
#if defined(__has_feature)
#if __has_feature(thread_sanitizer) || __has_feature(address_sanitizer)
static const bool is_sanitizer_build = true;
#else
static const bool is_sanitizer_build = false;
#endif
#else
static const bool is_sanitizer_build = false;
#endif

namespace nano
{
Expand Down Expand Up @@ -57,13 +67,7 @@ class network_constants
default_rpc_port = is_live_network () ? 7076 : is_beta_network () ? 55000 : 45000;
default_ipc_port = is_live_network () ? 7077 : is_beta_network () ? 56000 : 46000;
default_websocket_port = is_live_network () ? 7078 : is_beta_network () ? 57000 : 47000;
request_interval_ms = is_test_network () ? 20 : 16000;
// Increase interval for test TSAN/ASAN builds
#if defined(__has_feature)
#if __has_feature(thread_sanitizer) || __has_feature(address_sanitizer)
request_interval_ms = is_test_network () ? 100 : 16000;
#endif
#endif
request_interval_ms = is_test_network () ? (is_sanitizer_build ? 100 : 20) : 16000;
}

/** The network this param object represents. This may differ from the global active network; this is needed for certain --debug... commands */
Expand Down
2 changes: 1 addition & 1 deletion nano/node/nodeconfig.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ class node_config
std::chrono::milliseconds block_processor_batch_max_time{ 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 () ? std::chrono::seconds (5) : std::chrono::seconds (15) };
std::chrono::seconds tcp_io_timeout{ (network_params.network.is_test_network () && !is_sanitizer_build) ? std::chrono::seconds (5) : std::chrono::seconds (15) };
std::chrono::nanoseconds pow_sleep_interval{ 0 };
/** Default maximum incoming TCP connections, including realtime network & bootstrap */
unsigned tcp_incoming_connections_max{ 1024 };
Expand Down

0 comments on commit 75052a6

Please sign in to comment.