Skip to content

Commit 90b34d4

Browse files
authored
[ASAN]Increasing switch create timeout for ASAN images (sonic-net#2777)
**What I did** When running ASAN images with low CPU systems, due to the additional overhead associated with ASAN, it results in switch create timeout as seen in logs below. Hence increasing the **switch create timeout to 2x for ASAN builds.** e.g. For regular switch scenario, the timeout will be 120 seconds instead of 60 seconds. ``` Apr 18 20:23:46.749074 arc-switch1004 NOTICE swss#orchagent: :- create: request switch create with context 0 Apr 18 20:23:46.749074 arc-switch1004 NOTICE swss#orchagent: :- allocateNewSwitchObjectId: created SWITCH VID oid:0x21000000000000 for hwinfo: '' Apr 18 20:24:46.816998 arc-switch1004 ERR swss#orchagent: :- wait: SELECT operation result: TIMEOUT on getresponse Apr 18 20:24:46.817243 arc-switch1004 ERR swss#orchagent: :- wait: failed to get response for getresponse Apr 18 20:24:46.817405 arc-switch1004 ERR swss#orchagent: :- create: create status: SAI_STATUS_FAILURE Apr 18 20:24:46.817552 arc-switch1004 ERR swss#orchagent: :- main: Failed to create a switch, rv:-1 ``` **Why I did it** To avoid timeout to create switch when testing ASAN builds with lower CPU systems **How I verified it** Loaded the build with changes and verified no issues are seen
1 parent 11fc602 commit 90b34d4

1 file changed

Lines changed: 15 additions & 1 deletion

File tree

orchagent/main.cpp

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -585,7 +585,16 @@ int main(int argc, char **argv)
585585
attr.value.u64 = gSwitchId;
586586
attrs.push_back(attr);
587587

588-
if (gMySwitchType == "voq" || gMySwitchType == "fabric" || gMySwitchType == "chassis-packet")
588+
auto delay_factor = 1;
589+
bool asan_enabled = false;
590+
591+
if (getenv("ASAN_OPTIONS"))
592+
{
593+
asan_enabled = true;
594+
delay_factor = 2;
595+
}
596+
597+
if (gMySwitchType == "voq" || gMySwitchType == "fabric" || gMySwitchType == "chassis-packet" || asan_enabled)
589598
{
590599
/* We set this long timeout in order for orchagent to wait enough time for
591600
* response from syncd. It is needed since switch create takes more time
@@ -601,7 +610,12 @@ int main(int argc, char **argv)
601610
{
602611
attr.value.u64 = (10 * SAI_REDIS_DEFAULT_SYNC_OPERATION_RESPONSE_TIMEOUT);
603612
}
613+
else
614+
{
615+
attr.value.u64 = SAI_REDIS_DEFAULT_SYNC_OPERATION_RESPONSE_TIMEOUT;
616+
}
604617

618+
attr.value.u64 = attr.value.u64*delay_factor;
605619
attr.id = SAI_REDIS_SWITCH_ATTR_SYNC_OPERATION_RESPONSE_TIMEOUT;
606620
status = sai_switch_api->set_switch_attribute(gSwitchId, &attr);
607621

0 commit comments

Comments
 (0)