Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed Orchagent crashed when add and delete route at same time(#3436) #3438

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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