Skip to content

Commit 685075e

Browse files
authored
Remove RIF from m_rifsToAdd before deleting it (sonic-net#3336)
* Remove RIF from m_rifsToAdd before deleting RIF What I did I extended the RIF removal functionality to also remove the port from the m_rifsToAdd list. Why I did it Typically, the counter and object handling logic follows a strict sequence: Create an object, then start counter polling. Stop counter polling, then remove the object. However, there is deferred logic for RIF counters, where counter polling starts based on a timer rather than immediately. This process generally works as follows: Create an object and add it to a list upon receiving an APP_DB update. Start counter polling for all objects in the list during the timer event. Stop counter polling for an object. Remove the object. If RIF creation and removal occur frequently, removal can happen before the timer event. As a result, the timer may start counter polling for an object that has just been removed, causing the following error message: ERR syncd#SDK: :- processFlexCounterEvent: port VID oid:0x600000000099d, was not found (probably port was removed/splitted) and will remove from counters now
1 parent 4b8cad4 commit 685075e

File tree

1 file changed

+17
-3
lines changed

1 file changed

+17
-3
lines changed

orchagent/intfsorch.cpp

Lines changed: 17 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1329,8 +1329,21 @@ bool IntfsOrch::removeRouterIntfs(Port &port)
13291329
return false;
13301330
}
13311331

1332-
const auto id = sai_serialize_object_id(port.m_rif_id);
1333-
removeRifFromFlexCounter(id, port.m_alias);
1332+
bool port_found = false;
1333+
for (auto it = m_rifsToAdd.begin(); it != m_rifsToAdd.end(); ++it)
1334+
{
1335+
if (it->m_rif_id == port.m_rif_id)
1336+
{
1337+
m_rifsToAdd.erase(it);
1338+
port_found = true;
1339+
break;
1340+
}
1341+
}
1342+
if (!port_found)
1343+
{
1344+
const auto id = sai_serialize_object_id(port.m_rif_id);
1345+
removeRifFromFlexCounter(id, port.m_alias);
1346+
}
13341347

13351348
sai_status_t status = sai_router_intfs_api->remove_router_interface(port.m_rif_id);
13361349
if (status != SAI_STATUS_SUCCESS)
@@ -1759,4 +1772,5 @@ void IntfsOrch::voqSyncIntfState(string &alias, bool isUp)
17591772
m_tableVoqSystemInterfaceTable->hset(port_alias, "oper_status", isUp ? "up" : "down");
17601773
}
17611774

1762-
}
1775+
}
1776+

0 commit comments

Comments
 (0)