Skip to content

Commit

Permalink
Fixed Orchagent crashed when add and delete route at same time(sonic-…
Browse files Browse the repository at this point in the history
  • Loading branch information
yangyue8 committed Dec 20, 2024
1 parent eae729e commit 9c5a915
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
10 changes: 9 additions & 1 deletion orchagent/routeorch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -975,6 +975,7 @@ void RouteOrch::doTask(Consumer& consumer)
// Go through the bulker results
auto it_prev = consumer.m_toSync.begin();
m_bulkNhgReducedRefCnt.clear();
m_bulkNhReducedRefCnt.clear();
while (it_prev != it)
{
KeyOpFieldsValuesTuple t = it_prev->second;
Expand Down Expand Up @@ -1070,6 +1071,13 @@ void RouteOrch::doTask(Consumer& consumer)
removeNextHopGroup(it_nhg.first);
}
}
for (auto& it_nh : m_bulkNhReducedRefCnt)
{
if (it_nh.isMplsNextHop() && (m_neighOrch->getNextHopRefCount(it_nh) == 0))
{
m_neighOrch->removeMplsNextHop(it_nh);
}
}
}
}

Expand Down Expand Up @@ -2608,7 +2616,7 @@ bool RouteOrch::removeRoutePost(const RouteBulkContext& ctx)
if (nexthop.isMplsNextHop() &&
(m_neighOrch->getNextHopRefCount(nexthop) == 0))
{
m_neighOrch->removeMplsNextHop(nexthop);
m_bulkNhReducedRefCnt.push_back(nexthop);
}
else if (nexthop.isSrv6NextHop() &&
(m_neighOrch->getNextHopRefCount(nexthop) == 0))
Expand Down
2 changes: 2 additions & 0 deletions orchagent/routeorch.h
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,8 @@ class RouteOrch : public Orch, public Subject
std::set<std::pair<NextHopGroupKey, sai_object_id_t>> m_bulkNhgReducedRefCnt;
/* m_bulkNhgReducedRefCnt: nexthop, vrf_id */

std::vector<NextHopKey> m_bulkNhReducedRefCnt;

std::set<IpPrefix> m_SubnetDecapTermsCreated;
ProducerStateTable m_appTunnelDecapTermProducer;

Expand Down

0 comments on commit 9c5a915

Please sign in to comment.