simulation can sometimes randomly hang or throw connection_failed, instead of always doing one or the other

This commit is contained in:
Evan Tschannen 2019-11-21 16:24:18 -08:00
parent 067dc55bfb
commit 27cb299d84
3 changed files with 3 additions and 3 deletions

View File

@ -803,7 +803,7 @@ public:
virtual Future<Reference<IConnection>> 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 );

View File

@ -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 );

View File

@ -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;