From 27cb299d84e68eaad617e252a84de37a28b0fe3f Mon Sep 17 00:00:00 2001 From: Evan Tschannen Date: Thu, 21 Nov 2019 16:24:18 -0800 Subject: [PATCH] simulation can sometimes randomly hang or throw connection_failed, instead of always doing one or the other --- fdbrpc/sim2.actor.cpp | 2 +- flow/Knobs.cpp | 2 +- flow/Knobs.h | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/fdbrpc/sim2.actor.cpp b/fdbrpc/sim2.actor.cpp index 34b175340d..21b7963ff9 100644 --- a/fdbrpc/sim2.actor.cpp +++ b/fdbrpc/sim2.actor.cpp @@ -803,7 +803,7 @@ public: virtual Future> connect( NetworkAddress toAddr, std::string host ) { ASSERT( !toAddr.isTLS() && host.empty()); if (!addressMap.count( toAddr )) { - if(FLOW_KNOBS->ENABLE_CONNECT_ERRORS) { + if(FLOW_KNOBS->SIM_CONNECT_ERROR_MODE == 1 || (FLOW_KNOBS->SIM_CONNECT_ERROR_MODE == 2 && deterministicRandom()->random01() > 0.5)) { throw connection_failed(); } return waitForProcessAndConnect( toAddr, this ); diff --git a/flow/Knobs.cpp b/flow/Knobs.cpp index 9498a94617..f7a3037a3e 100644 --- a/flow/Knobs.cpp +++ b/flow/Knobs.cpp @@ -131,7 +131,7 @@ FlowKnobs::FlowKnobs(bool randomize, bool isSimulated) { init( SLOW_NETWORK_LATENCY, 100e-3 ); init( MAX_CLOGGING_LATENCY, 0 ); if( randomize && BUGGIFY ) MAX_CLOGGING_LATENCY = 0.1 * deterministicRandom()->random01(); init( MAX_BUGGIFIED_DELAY, 0 ); if( randomize && BUGGIFY ) MAX_BUGGIFIED_DELAY = 0.2 * deterministicRandom()->random01(); - init( ENABLE_CONNECT_ERRORS, false ); if( randomize && BUGGIFY ) ENABLE_CONNECT_ERRORS = true; + init( SIM_CONNECT_ERROR_MODE, deterministicRandom()->randomInt(0,3) ); //Tracefiles init( ZERO_LENGTH_FILE_PAD, 1 ); diff --git a/flow/Knobs.h b/flow/Knobs.h index 1b4d248c40..430c141115 100644 --- a/flow/Knobs.h +++ b/flow/Knobs.h @@ -153,7 +153,7 @@ public: double SLOW_NETWORK_LATENCY; double MAX_CLOGGING_LATENCY; double MAX_BUGGIFIED_DELAY; - bool ENABLE_CONNECT_ERRORS; + int SIM_CONNECT_ERROR_MODE; //Tracefiles int ZERO_LENGTH_FILE_PAD;